std.json

Implements functionality to read and write JavaScript Object Notation values.

JavaScript Object Notation is a lightweight data interchange format commonly used in web services and configuration files. It's easy for humans to read and write, and it's easy for machines to parse and generate.

Warning: While JSONValue is fine for small-scale use, at the range of hundreds of megabytes it is known to cause and exacerbate GC problems. If you encounter problems, try replacing it with a stream parser. See also https://forum.dlang.org/post/dzfyaxypmkdrpakmycjv@forum.dlang.org.

Members

Classes

JSONException
class JSONException

Exception thrown on JSON errors

Enums

JSONFloatLiteral
enum JSONFloatLiteral

String literals used to represent special float values within JSON strings.

JSONOptions
enum JSONOptions

Flags that control how JSON is encoded and parsed.

JSONType
enum JSONType

Enumeration of JSON types

Functions

parseJSON
JSONValue parseJSON(T json, int maxDepth, JSONOptions options)

Parses a serialized string and returns a tree of JSON values.

parseJSON
JSONValue parseJSON(T json, JSONOptions options)

Parses a serialized string and returns a tree of JSON values.

toJSON
string toJSON(JSONValue root, bool pretty, JSONOptions options)

Takes a tree of JSON values and returns the serialized string.

toJSON
void toJSON(Out json, JSONValue root, bool pretty, JSONOptions options)

Structs

JSONValue
struct JSONValue

JSON value node

Meta

Authors

Jeremie Pelletier, David Herberth References: http://json.org/, http://seriot.ch/parsing_json.html