fast.json

A fast JSON parser implementing RFC 7159.

The most prominent change compared to the initial revision is the allowance of all data types as root values, not just objects and arrays.

More...

Members

Enums

DataType
enum DataType

JSON data types returned by peek.

trustedSource
anonymousenum trustedSource

Validation strength of JSON parser

Functions

parseJSON
auto parseJSON(T text)

Loads a JSON string and validates the used parts. This includes a UTF-8 validation on strings.

parseTrustedJSON
auto parseTrustedJSON(T text)

Load a JSON string that is considered 100% correct. No checks will be performed, not even if you try to read a number as a string.

serializationLength
size_t serializationLength(T t)
Undocumented in source. Be warned that the author may not have intended to support it.
serializationLength
size_t serializationLength(T t)
Undocumented in source. Be warned that the author may not have intended to support it.
serializationLength
size_t serializationLength(T t)
Undocumented in source. Be warned that the author may not have intended to support it.
serializeJSON
char[] serializeJSON(char[] buf, T t)
Undocumented in source. Be warned that the author may not have intended to support it.
serializeJSON
char[] serializeJSON(char[] buf, T t)
Undocumented in source. Be warned that the author may not have intended to support it.
validateJSON
bool validateJSON(T text)

Validates a JSON string.

Structs

Json
struct Json(ALLOC, uint vl = validateUsed, bool validateUtf8 = vl > trustedSource)

This is a forward JSON parser for picking off items of interest on the go. It neither produces a node structure, nor does it produce events. Instead you can peek at the value type that lies ahead and/or directly consume a JSON value from the parser. Objects and arrays can be iterated over via foreach, while you can also directly ask for one or multiple keys of an object.

JsonMapping
struct JsonMapping

A UDA used to remap enum members or struct field names to JSON strings.

JsonParserState
struct JsonParserState

JSON parser state returned by the state property.

serialize
struct serialize

A UDA for including fields in serialization

Detailed Description

Usage Hints

  • This parser only supports UTF-8 without BOM.
  • When a JSON object has duplicate keys, the last one in the set will determine the value of associative-array entries or struct fields.
  • BigInt and large number parsing are not implemented currently, but all integral types as well as minimal exact representations of many double values are supported.

Meta