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



Lloyd,

That's one odd thing about JSON that I've found... I would have thought to
be "consistent" that is would always start as an object name. This is
case where there is not.

I'm sure Scott and others will provide an answer but with the JSON parser I
put together I set it up so if the JSON starts with an array it simply
wraps another object around the entire thing. :)

So in your case it would be to retrieve the first element of the array it
would be data[1], data[2] for the second, etc.

So, what my parser does is make:
[
{object1},
{object2},
{object3}
]

into this:
{"data":[
{object1},
{object2},
{object3}
]
}

Just something I thought I'd throw out there since I wrote my JSON parser a
while back before anything was really available. I personally didn't like
how JSON let you start with an array so I worked around it in my own way.
:)

Brad
www.bvstools.com

On Wed, Jun 24, 2015 at 1:11 PM, Lloyd Bailey <lbailey@xxxxxxxxxxxxxxx>
wrote:

I'm using Scott Klement's YAJL to work with some JSON streams and RPG
programs. I'm loading the following tree example....
[
{ ARRAY ELEM 1 },
{ ARRAY ELEM 2 },
{ ARRAY ELEM 3 },
{ Etc...}
]

Note the JSON array does not have a name. Following Scott's JSON
presentation, he uses procedure, YAJL_OBJECT_FIND, to extract the array
node. If the node doesn't have a name, how do you gain access to the node?

Thanks
--
Lloyd Bailey
--
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: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.