Re: [fpc-pascal] JSON SAX-based reader

2017-06-24 Thread Michael Van Canneyt



On Fri, 23 Jun 2017, Stefan V. Pantazi wrote:


Thank you for this, Michael. I think it is wonderful work.

I've done some old tests of the new implementation and it looks very 
good. The only failed tests were related to date and time 
representation. This appears to be fixed in the new version. Most 
importantly, I see no memory leaks when parsing fails due to malformed 
JSON, and that is great!


The only fixes I had to do to my own software to accommodate the new 
implementation, were:


1) comment out the "Strict" property of the TJSONParser (it appears it 
no longer exists); I used to set it to false, to allow for more 
flexibility in JSON syntax.


It has been superseded by the more flexible 'Options' property since quite some 
time;
It was marked 'deprecated' in 3.0, and has now been removed in trunk.



2) add the missing procedure SetKey(obj:TJSONObject); to TJSONConfig 
since it was removed from the new version of jsonconf.pp; anyway, in 
this particular case, it may be me that has to rethink and simplify my 
use of the json config component that does not need SetKey.


The JSONConfig has not been changed recently, I suspect this change was
already in 3.0.



Hope this helps,


It does, and I hope the above helps you in reviving your code :)

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] JSON SAX-based reader

2017-06-23 Thread Stefan V. Pantazi

Thank you for this, Michael. I think it is wonderful work.

I've done some old tests of the new implementation and it looks very 
good. The only failed tests were related to date and time 
representation. This appears to be fixed in the new version. Most 
importantly, I see no memory leaks when parsing fails due to malformed 
JSON, and that is great!


The only fixes I had to do to my own software to accommodate the new 
implementation, were:


1) comment out the "Strict" property of the TJSONParser (it appears it 
no longer exists); I used to set it to false, to allow for more 
flexibility in JSON syntax.


2) add the missing procedure SetKey(obj:TJSONObject); to TJSONConfig 
since it was removed from the new version of jsonconf.pp; anyway, in 
this particular case, it may be me that has to rethink and simplify my 
use of the json config component that does not need SetKey.


Hope this helps,

Stefan


On 06/23/2017 02:48 AM, Michael Van Canneyt wrote:


Hello,

I have changed the JSON parser, it is now written on top of a SAX-like JSON
reader (which is available separately). All unit tests work fine, and the
few extra tests which I did also, but I would like to hear if someone has
code that no longer works.

The change is committed in trunk. The new JSON reader is available in the
unit jsonreader. Useful if you want to process large amounts of JSON data
without building the whole JSON document in memory.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


--
___
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] JSON SAX-based reader

2017-06-23 Thread Michael Van Canneyt



On Fri, 23 Jun 2017, Benito van der Zander wrote:


Hi,


Useful if you want to process large amounts of JSON data
without building the whole JSON document in memory. 



I have always used jsonscanner for that...


Well, JSONScanner does not do structural JSON validation. 
JSONReader does.

JSONReader of course uses JSONScanner to get the tokens.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] JSON SAX-based reader

2017-06-23 Thread Michael Van Canneyt


Hello,

I have changed the JSON parser, it is now written on top of a SAX-like JSON
reader (which is available separately). All unit tests work fine, and the
few extra tests which I did also, but I would like to hear if someone has
code that no longer works.

The change is committed in trunk. The new JSON reader is available in the
unit jsonreader. Useful if you want to process large amounts of JSON data
without building the whole JSON document in memory.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal