Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Functions jsonDeserialise

1
2
3
4
5
6
7
8
module juptune.data.json.serialise;

Result jsonDeserialise(
    ToDeserialiseT
)(
    JsonParser json, 
    ToDeserialiseT toDeserialiseInto
);

Documentation

Deserialisation

Deserialises JSON into the desired type.

Support

All primitive types supported by JsonParser.Token.

Slices of any supported type. Slices cause this function to become @gc.

Array!Twhere Tis any supported type.

Array!charis special-cased for only supporting strings.

Stringis supported for strings.

Nullable!Twhere Tis any supported type.

Structs, where fields are marked with @Jsonare subject to deserialisation.

const(char)[]is currently NOT** supported since I don't know what I want to do with it right now.

Notes

This function doesn't call .finishon the JsonParser, the caller will need to do that themselves when appropriate.

For "wrapper" types like Nullableand structs, if any subtype of these wrappers calls into an @gc deserialiser (e.g. stringor stuff like int[]), then this function becomes @gcthe whole way through.

For an @nogcinvocation you may only use @nogccompatible types.

Params

Throws

JsonSerialiseError.wrongTypeif an incorrect token is encountered during deserialisation.

JsonSerialiseError.keyRedefinedfor structs if the JSON input has a duplicate key.

JsonSerialiseError.keyNotRecognisedfor structs if the JSON input contains a key that doesn't exist inside of ToDeserialiseInto.

Anything that JsonParsercan throw.