Thread overview
Is there such a JSON parser?
Jan 01, 2023
torhu
Jan 02, 2023
Salih Dincer
Jan 02, 2023
thebluepandabear
Jan 02, 2023
torhu
Jan 02, 2023
SealabJaster
Jan 02, 2023
torhu
Jan 02, 2023
Chris Piker
Jan 02, 2023
torhu
January 01, 2023

I need to parse some JSON data into various data structures, so I'm looking for a parser based on events or ranges. One that doesn't just load the file and build a data structure that represents the whole thing. So not std.json, at least.

January 02, 2023

On Sunday, 1 January 2023 at 23:28:12 UTC, torhu wrote:

>

I need to parse some JSON data into various data structures, so I'm looking for a parser based on events or ranges. One that doesn't just load the file and build a data structure that represents the whole thing. So not std.json, at least.

There may be suggestions that will come in handy in a discussion that here:

https://forum.dlang.org/thread/wtnxglafyxhscspqcdwj@forum.dlang.org

SDB@79

January 02, 2023

On Sunday, 1 January 2023 at 23:28:12 UTC, torhu wrote:

>

I need to parse some JSON data into various data structures, so I'm looking for a parser based on events or ranges. One that doesn't just load the file and build a data structure that represents the whole thing. So not std.json, at least.

I'm new to D and also haven't found any solid JSON libraries. Unfortunately a massive downside for D is the fact that the ecosystem is very small when compared to other languages such as Java.

You might want to try the following:

https://github.com/libmir/asdf

January 02, 2023

On Sunday, 1 January 2023 at 23:28:12 UTC, torhu wrote:

>

I need to parse some JSON data into various data structures, so I'm looking for a parser based on events or ranges. One that doesn't just load the file and build a data structure that represents the whole thing. So not std.json, at least.

Are you asking for a SAX-styled parser for JSON?

Similarly - what would you like to see from a full-featured JSON module?

For context: I'm currently (very slowly) working on a -betterC library. The JSON lexer is able to work off of buffered data streams instead of flat in-memory arrays. So even if what you're looking for doesn't exist right now, I'd like to try and (again; very slowly) change that.

January 02, 2023

On Monday, 2 January 2023 at 05:44:33 UTC, thebluepandabear wrote:

>

You might want to try the following:

https://github.com/libmir/asdf

I had a look at that, but I think it just loads the whole file into it's own data structure. And then you can use attributes to get it to fill structs with data, but that's too basic for my needs.

January 02, 2023

On Monday, 2 January 2023 at 14:56:27 UTC, SealabJaster wrote:

>

Are you asking for a SAX-styled parser for JSON?

Yes, I actually want to replace a SAX parser.

January 02, 2023

On Monday, 2 January 2023 at 14:56:27 UTC, SealabJaster wrote:

>

Are you asking for a SAX-styled parser for JSON?

I have an upcoming project (about 3-6 months away) that could make use of this as well. If you need someone to try it out please let me know and I'll give it a spin. Good luck on your library.

Cheers,

January 02, 2023

On 1/1/23 6:28 PM, torhu wrote:

>

I need to parse some JSON data into various data structures, so I'm looking for a parser based on events or ranges. One that doesn't just load the file and build a data structure that represents the whole thing. So not std.json, at least.

It's pretty rough-edged, but https://code.dlang.org/packages/jsoniopipe will do this. It has mechanisms to jump to specific object members, and to rewind to a cached point. It does not use any intermediate representation.

-Steve

January 02, 2023

On Monday, 2 January 2023 at 21:36:10 UTC, Steven Schveighoffer wrote:

>

On 1/1/23 6:28 PM, torhu wrote:

>

I need to parse some JSON data into various data structures, so I'm looking for a parser based on events or ranges. One that doesn't just load the file and build a data structure that represents the whole thing. So not std.json, at least.

It's pretty rough-edged, but https://code.dlang.org/packages/jsoniopipe will do this. It has mechanisms to jump to specific object members, and to rewind to a cached point. It does not use any intermediate representation.

-Steve

Thank, I can check it out.