Perhaps Scott can help with that, because it is a very good question.
I re-ran my tests and the json_parse() procedure in the RPGNEXTGEN JSON service program is successfully parsing the string AND is taking 16274ms to do it!
Yajl_stmf_load_tree() is taking 57ms to complete so it is massively quicker. It does appear that loading the tree like this does require you to know the contents of the JSON beforehand so that you can retrieve specific nodes, so whether or not it is a fair comparison I am not sure. In any case, 16 seconds is dreadful.
I guess if you don't know the contents, you would have to use yajl_xxxx_parse() instead, and give it event handlers that would test the node type with yajl_is_<something>() before deciding what to do with it.
-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Nathan Andelin
Sent: 01 June 2015 18:19
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] receiving POST encoded in JSON
Following are a few code snippets from one of Scott Klement's presentations on YAJL:
docNode = yajl_stmf_load_tree( '/tmp/example.json' : errMsg );
Without additional documentation or reviewing the code, it's not clear what
yajl_stmf_load_tree() may be doing doing. Is it really parsing the stream file? Or is it just returning a pointer to the first "node" in the tree?
The following appears to be parsing, but the syntax affirms that the programmer must know the layout of the file beforehand - that it contains an array of objects which contains a set of name-value pairs.
list = YAJL_object_find(docNode: 'list');
i = 0;
dow YAJL_ARRAY_LOOP( list: i: node );
j = 0;
dow YAJL_OBJECT_LOOP( node: j: key: val);
exsr load_subfield;
enddo;
enddo;
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.
___________________________________________
This email has been scanned by iomartcloud.
http://www.iomartcloud.com/
________________________________
NOTICE: The information in this electronic mail transmission is intended by CoralTree Systems Ltd for the use of the named individuals or entity to which it is directed and may contain information that is privileged or otherwise confidential. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email or by telephone, so that the sender's address records can be corrected.
--------------------------------------------------------------------------------
CoralTree Systems Limited
Company Registration Number 5021022.
Registered Office:
12-14 Carlton Place
Southampton
Hampshire
SO15 2EA
VAT Registration Number 834 1020 74.
As an Amazon Associate we earn from qualifying purchases.