int | missing | absent

bauss jj_1337 at live.dk
Fri Jun 24 06:54:50 UTC 2022


On Thursday, 23 June 2022 at 15:20:02 UTC, Jesse Phillips wrote:
> 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.

I'm in a similar boat as you, except for that I read a lot of big 
json files and I absolutely cannot read everything in the json 
and hold them in memory, so I must be selective in what I read 
from the json files, since they're read on a server and are 
several GB. I would be wasting a lot of RAM resources by having 
every field in the json file stored in memory. RAM is expensive, 
disk space is not.


More information about the Digitalmars-d-learn mailing list