Kevin



I have made two sample programs that



a. Uses Scott’s HTTPAPI to post a raw JSON file to a JSON based REST
service

http://powerext.com/yajlreq.txt



b. Uses Apache/powerEXT Core to consume the posted JSON and return a
message

http://powerext.com/yajl.txt



It is not as simple as it sounds because of how Apache treats/converts
incoming and outgoing UTF-8 to local EBCDIC CCSID in messages depending on
the content-type in the mime headers, but that you know all about since you
do all the conversion yourself ;-)



On Tue, Jun 2, 2015 at 3:11 PM, Kevin Turner <
kevin.turner@xxxxxxxxxxxxxxxxxxxx> wrote:

Since the RPGNEXTGEN JSON service program works well (and is embedded in
lots of places here) but is appallingly slow at parsing strings, I have
left it alone and simply replaced all calls the json_parse() with my own
YAJL wrapper called yajl_parseinto(). So this uses Scott's port of the
YASL parser, and then walks through the tree building an rpgnextgen json
object. Despite doing all this work, the difference is still
significantly faster:

JSON parse=16022ms
YAJL parse=322ms


-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Kevin
Turner
Sent: 01 June 2015 21:49
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] receiving POST encoded in JSON

Not as stunned as me - because I am using it in production, and now face a
rather onerous re-engineering process :( Serves me right for not doing more
thorough research into the options. On the flip side, it does help me
explain some trouble performance bottlenecks.

As it happens, I do have a "use case" where I need to walk through a JSON
with no prior knowledge of its exact content. It involves simply comparing
the JSON (a data model for a context) with the previous version (stored in
a session) to work out what the delta is. I basically need to know that a
node is new, missing or changed to build the delta with no assumed
knowledge of what the nodes are. I expect the yajl_xxxx_parse will enable
me to do this.


-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Nathan
Andelin
Sent: 01 June 2015 21:39
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] receiving POST encoded in JSON

Scott,

Thanks for the additional information. I was so stunned by Kevin's report
of performance differences between your service program and that of Mihael
Schmidt; I was looking for an explanation. Unfortunately, I'm not well
versed in either; I haven't had a requirement to "consume" JSON under IBM i
yet. I'm interested in the topic, however.

I agree that "applications" typically know the format of JSON documents in
advance. An API that makes it easy to "find" the content you're looking for
is intuitive in that case.

I've been toying with writing a JavaScript utility that "merges" HTML
templates with JSON objects, where neither the format of the HTML nor the
JSON would be known in advance. I suppose that may have triggered the idea
of a similar use case under IBM i, though that is just an abstract notion
at this point.

I view the topic of JSON to be relevant to the topic of single-page
applications, client-side frameworkd, and possibly server-side web-service
frameworks, which we have been discussing during the past few weeks.
--
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.
--
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.
--
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.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.