12345678module juptune.data.json.serialise;
Result jsonDeserialise(
ToDeserialiseT
)(
JsonParser json,
ToDeserialiseT toDeserialiseInto
);
Deserialisation
Deserialises JSON into the desired type.
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.
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.
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.