× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



YAJL is one of two thing:

1. A processor the reads through a JSON structure and returns values in
nodes.
2. A JSON generator that generates JSON in a buffer.

It has no Object Oriented capabilities so if you want to extract part of a
JSON structure
you are simply using a wrong programming language.

Javascript/node.js support this nativly since JSON is a text notation of a
javascript object
and you are ablte to extract any part of the javascript object and the
serialize it back to
JSON.

So use RPGLE to simple process/generation of JSON and node.js to advanced
process/
generation of JSON. And yes, you may call node.js modules from RPGLE and
vice versa
using profounds connector.


On Fri, Sep 15, 2017 at 5:10 PM, Bradley Stone <bvstone@xxxxxxxxx> wrote:

You could just make you're own log as you spin through the array. Or do
you want to save the exact JSON array as it is? That may be difficult.

If that's the case I'd just save the whole thing for the log. Saving a
array node to a string would take a little extra work. If you look through
the YAJL code you may be able to see how to do it.

Bradley V. Stone
www.bvstools.com
MAILTOOL Benefit #9 <https://www.bvstools.com/mailtool.html>: Superior
debugging (when using MAILTOOL Plus) - Bypassing the IBM SMTP server means
that we can fully debug and track down sometimes hard to find problems.
Even the Trace TCP/IP Application (TRCTCPAPP) command won't be this
detailed!


On Fri, Sep 15, 2017 at 9:28 AM, Slanina, John <jslanina@xxxxxxxxxx>
wrote:

Bradley,

It is a web service call using RXS-XML library the whole JSON Document
comes back in a string.
With I then I do this code.

But I want the array element node "VAL" to be logged not docnode.

docNode = yajl_buf_load_tree(%addr(gXmlResponse:*data) :
%len(gXmlResponse) : JsonErrMsg);
Node = YAJL_object_find(docNode : 'found');

if YAJL_IS_TRUE(Node);
//
// Update NextPage
//
chain (Subscription_P) ofsupd01 ofsupd01Ds;
if not %found(ofsupd01);
exsr Exitpgm;
endif;

Node = YAJL_object_find(docNode : 'nextPage');
nextPage = YAJL_get_string(Node);

ofsupd01Ds.nextPage = nextPage;
ofsupd01Ds.LastPollDate = %dec(%date():*cymd);
ofsupd01Ds.LastPollTime = %dec(%Time():*ISO);
ofsupd01Ds.LastPollStatus = 'G';

update ofsup01f ofsupd01Ds;

items = YAJL_object_find(docNode: 'items');

i = *zeros;

dow YAJL_ARRAY_LOOP( items : i: val );
Node = YAJL_object_find(Val : 'eventType');
eventType = YAJL_get_string(Node);

clear oftrtv01Ds;
chain (Subscription_P : eventType) oftrtv01 oftrtv01Ds;
if %found(oftrtv01);
if oftrtv01Ds.Program <> 'NA' and oftrtv01Ds.status = 'A';
monitor;
writeJobLog('Calling ' + %trim(eventType) + ' ' +
%trim(oftrtv01Ds.Program) + X'25');
program(eventType : val );
on-error;
writeJobLog('*** ERROR *** Calling ' + %trim(eventType) + '
' +
%trim(oftrtv01Ds.Program) + X'25');
endmon;
endif;
endif;
enddo;
endif;


Val is the one I want to convert to a string which is an Object not a
string .




--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.