ae.utils.json

JSON encoding.

Members

Aliases

JsonSerializer
alias JsonSerializer = CustomJsonSerializer!(JsonWriter!StringBuilder)

JSON serializer with StringBuilder output.

Functions

jsonParse
T jsonParse(C[] s)

Parse the JSON in string s and deserialize it into an instance of T.

jsonParse
void jsonParse(C[] s, T result)

Parse the JSON in string s and deserialize it into T.

mixNonSerializedFields
string mixNonSerializedFields(string[] fields)
Undocumented in source. Be warned that the author may not have intended to support it.
toJson
string toJson(T v)

Serialize T to JSON, and return the result as a string.

toPrettyJson
string toPrettyJson(T v)

Serialize T to a pretty (indented) JSON string.

Structs

CustomJsonSerializer
struct CustomJsonSerializer(Writer)

Abstract JSON serializer based on Writer.

JSONFragment
struct JSONFragment

Fragment of raw JSON. When serialized, the .json field is inserted into the resulting string verbatim, without any validation. When deserialized, will contain the raw JSON of one JSON object of any type.

JSONName
struct JSONName

User-defined attribute - specify name for JSON object field. Useful when a JSON object may contain fields, the name of which are not valid D identifiers.

JSONOptional
struct JSONOptional

User-defined attribute - only serialize this field if its value is different from its .init value.

JSONPartial
struct JSONPartial

User-defined attribute - skip unknown fields when deserializing.

JsonWriter
struct JsonWriter(Output)

Basic JSON writer.

PrettyJsonWriter
struct PrettyJsonWriter(Output, alias indent = '\t', alias newLine = '\n', alias pad = ' ')

JSON writer with indentation.

Templates

NonSerialized
template NonSerialized(fields...)

A template that designates fields which should not be serialized to Json.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Vladimir Panteleev <ae@cy.md>