int | missing | absent
Jesse Phillips
Jesse.K.Phillips+D at gmail.com
Thu Jun 23 15:20:02 UTC 2022
On Wednesday, 22 June 2022 at 01:09:22 UTC, Steven Schveighoffer
wrote:
> There are 3 situations:
>
> 1. field in json and struct. Obvious result.
> 2. field in json but not in struct.
> 3. field in struct but not in json.
I do a lot of reading JSON data in C#, and I heavily lean on
optional over required.
The reason optional is so beneficial is because I'm looking to
pull out specific data points from the JSON, I have no use nor
care about any other field. If I had to specify every field being
provided, every time something changes, the JSON parser would be
completely unusable for me.
I do like the @extra assuming it allows reserializing the entire
JSON object. But many times that data just isn't needed and I'd
like my type to trim it.
More information about the Digitalmars-d-learn
mailing list