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

Structs Json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module juptune.data.json.serialise;

struct Json
{
    /++ VARIABLES ++/
    
    /// If non-empty, the value of this field is used as the name when serialising/deserialising. 
    string name;
    /// If true, then if the attached field is empty, it won't be written when serialising, and it will be set to its .init value when deserialising a JSON value where the field is null/absent. 
    bool omitWhenEmpty;
    /// Similar to omitWhenEmpty , except the omission only occurs if the field is null when serialising. 
    bool omitWhenNull;
    /// If true, then null is written as a field's value if it would otherwise be omitted (see omitWhenEmpty and omitWhenNull ) 
    bool useNullForOmit;
}

Documentation

A UDA to be attached onto any fields of a type that is meant to be the target of JSON serialisation/deserialisation.

ONLY fields with this UDA attached will be considered targets by (de)serialisation functions - even if only the type itself is attached attached as @Json

This UDA only affects fields within a struct (e.g. attaching it onto a struct directly does nothing).

Variables

Name Description
name

If non-empty, the value of this field is used as the name when serialising/deserialising.

omitWhenEmpty

If true, then if the attached field is empty, it won't be written when serialising, and it will be set to its .initvalue when deserialising a JSON value where the field is null/absent.

omitWhenNull

Similar to omitWhenEmpty, except the omission only occurs if the field is null when serialising.

useNullForOmit

If true, then nullis written as a field's value if it would otherwise be omitted (see omitWhenEmptyand omitWhenNull)