A new design for a JSON Parser

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

A new design for a JSON Parser

Anthony Walter-3
I know the FCL already has a capable JSON parser, but I am writing some Amazon web service interfacing projects and wanted a smaller easier to use JSON parser to assist. I've create a new design for a JSON parser that is pretty small, yet powerful.

If your interested, I've posted the code under GPLv3 and a write up of my thought process and the workflow of using an single small class to work with JSON:


Any and all feedback is welcome.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: A new design for a JSON Parser

Free Pascal - General mailing list
Very cool library.

It would be nice if separator character can be change

For example, for me personally

aval := n.find('billTo.name'). value;

more intuitive instead of

aval := n.find('billTo/name'). value;

Also AFAIK, GPL v3 license will require application using this library must use GPL too.

Zamrony P. Juhara

Fano Framework 


On Mon, Aug 26, 2019 at 15:12, Anthony Walter
I know the FCL already has a capable JSON parser, but I am writing some Amazon web service interfacing projects and wanted a smaller easier to use JSON parser to assist. I've create a new design for a JSON parser that is pretty small, yet powerful.

If your interested, I've posted the code under GPLv3 and a write up of my thought process and the workflow of using an single small class to work with JSON:


Any and all feedback is welcome.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Untitled (234 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: A new design for a JSON Parser

Anthony Walter-3
Adding a global redefinable separator character is a good idea which I might add. With regards to using the forward slash, I am just reusing the XPath way of doing things and was considering adding a few more XPath like queries. For example:

N.Find('/inventory/999/sku'); // search from root if the first path character is '/', find the 999th node, return the sku
N.Find('//item[name="widget"]/price'); // search for the first item in the entire document ('//') with a name of widget, return its price
N.Find('//item[recalled]/name'); // search for the first item with a recalled node and return the name

And so on ...

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal