123456789101112131415module 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;
}
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).
| 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 |
| omitWhenNull |
Similar to |
| useNullForOmit |
If true, then |