Re: Is there such a JSON parser?

2023-01-02 Thread torhu via Digitalmars-d-learn
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.


Re: Is there such a JSON parser?

2023-01-02 Thread Steven Schveighoffer via Digitalmars-d-learn

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


Re: Is there such a JSON parser?

2023-01-02 Thread Chris Piker via Digitalmars-d-learn

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,




Re: Is there such a JSON parser?

2023-01-02 Thread torhu via Digitalmars-d-learn

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.


Re: Is there such a JSON parser?

2023-01-02 Thread torhu via Digitalmars-d-learn

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.


Re: Is there such a JSON parser?

2023-01-02 Thread SealabJaster via Digitalmars-d-learn

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.


Re: Is there such a JSON parser?

2023-01-01 Thread thebluepandabear via Digitalmars-d-learn

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





Re: Is there such a JSON parser?

2023-01-01 Thread Salih Dincer via Digitalmars-d-learn

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/wtnxglafyxhscspqc...@forum.dlang.org

SDB@79


Is there such a JSON parser?

2023-01-01 Thread torhu via Digitalmars-d-learn
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.