How to parse JSON in D?

Steven Schveighoffer schveiguy at gmail.com
Mon Mar 29 18:19:35 UTC 2021


On 3/29/21 1:48 PM, Imperatorn wrote:
> On Monday, 29 March 2021 at 17:21:25 UTC, tastyminerals wrote:
>> We need to parse a bunch of JSON files. What does D have? It has 
>> std.json which is strangely slower than Python json :(
>> Ok, we go to dub repository and search for something that is faster. 
>> There are basically two implementations fast.json and stdx.data.json. 
>> The first one refuses to work on Mac M1 chip so we take the 
>> stdx.data.json, go to the documentation page and see two three 
>> snippets on how to use the library. The code examples are so scarce 
>> that I feel like a person who did it was forced to do it out of his 
>> own will.
>>
>> [...]
> 
> https://youtu.be/un-bZdyumog?t=27m25s

FYI that package is here: https://code.dlang.org/packages/jsoniopipe

I really want to start using it, but priorities.

It should be pretty functional, but it's a bit hard to use at the moment 
(unless you just want serialization). I need to work on the parsing API. 
The benefit is it allows parsing the JSON without constructing some 
tree-like representation of the data. The serializer uses this directly, 
which makes it fast. Probably not as fast as asdf, but I could maybe get 
it there with some tricks.

-Steve


More information about the Digitalmars-d-learn mailing list