× 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.



Hi Brad,

In YAJL, the reader and generator are two completely different things, it's just the way it was designed.

So what you'd need to do is write a routine that basically loops through the data in a given element, and calls the generator routines to add it to the current document. That's actually very similar to what the stringify routine does internally, except that stringify creates a separate document and then returns the output as a string rather than adding it to the existing open document that the RPG caller is generating.

So this would not be hard to create. If I can find the time, I'll try to add the feature. But, it's bad timing because my spring conferences all start next week, so I have a lot of extra work on my plate right now.

-SK


On 3/8/2018 8:30 AM, Bradley Stone wrote:
Because the end result was going to be a stream file anyhow, I just updated
the application to read the JSON, stringify it, then write it out using IFS
APIs.

Pretty simple but it would be nice to have something to add to a json
buffer using a node from another json buffer.

The reason for doing this is a web service I am working with for a customer
returns a max of 20 records at a time. So I needed to join all the
information in each set of records into one JSON file.

Bradley V. Stone
www.bvstools.com
MAILTOOL Benefit #4 <https://www.bvstools.com/mailtool.html>: Easily add
attachments of any type from the IFS to outgoing emails.

On Wed, Mar 7, 2018 at 5:03 PM, Bradley Stone <bvstone@xxxxxxxxx> wrote:

Yep. Pouring through the source too. Can't find anything. I don't want
to modify the C source either.. been a while for that.. lol.

If there was a way to parse through a tree without knowing the names and
values/types I could probably do it that way,. But I'd like to say "take
this node, and insert it in the json I'm generating".

Right now it "almost" works with yajl_addChar(yajl_stringifyStr(node))
except that it of course escapes quotes and slashes, etc. And that seems
to be a setting in the C source.

Bradley V. Stone
www.bvstools.com
MAILTOOL Benefit #13 <https://www.bvstools.com/mailtool.html>: The
ability to use an IFS stream file as the body of the email (either text or
html).

On Wed, Mar 7, 2018 at 11:38 AM, Jon Paris <jon.paris@xxxxxxxxxxxxxx>
wrote:

Have you looked at the base YAJL docs Brad? I'm in a hurry or I'd check
- but I found a couple fo useful "bits" when I went through them.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Mar 7, 2018, at 11:12 AM, Bradley Stone <bvstone@xxxxxxxxx> wrote:

I am looking into trying to read through one set of JSON data and write
certain objects/trees to a new JSON file.

Example:
yajl_genOpen(*OFF);
yajl_beginObj(); //main JSON object
yajl_beginArray('newList');

// load the old JSON data from a stream file
docNode = yajl_stmf_load_tree(jsonFile);

//find the array "list"
myList = YAJL_object_find(docNode: 'list');

i = 0;

dow YAJL_ARRAY_LOOP(myList:i:node );
yajl_beginObj();

//****write the contents of the "node" array object to the new JSON
buffer*****
yajl_endObj();
enddo;

yajl_tree_free(docNode);

yajl_endArray(); //newList
yajl_endObj(); //main JSON object
yajl_genClose();


I have tried:

yajl_addChar(yajl_stringifyStr(node));

But that stringifies and "escapes" the old JSON data. So what I'm
looking
for is something like:

yajl_addNode(node);

Where it will take a node loaded from another JSON object and add it
directly to the new JSON buffer. Not sure if that's possible. Just
want
to make sure there isn't something already out there that may do this
before I try digging into making a solution.

Thanks!

Bradley V. Stone
www.bvstools.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-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

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-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.