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



Hello Nihat,

I'm not familiar with YAJL and Scott Klement's API, but it looks to me as if your first statement assigns "node" the value of "data", the second assigns "node" the value of "generateIds" within "data", and the third assigns "node" the value of the first element of the array represented by "node" (i.e. "generateIds").

Am I right in guessing that YAJL changes JavasScript arrays to be 1-based instead of 0-based? If not, that might be your problem, since in JavaScript "data.generateIds[1]" is not defined. If so, then I would think that you were done after the third statement -- does "node" not contain its value? If not, what are the properties of YAJL_ARRAY_ELEM? I would think that one of them would have to be something like "VALUE" (?)

Hope this helps,

Mike Naughton


On 12/3/2016 3:16 PM, Nihat Ezer wrote:
Greetings,
The following is JSON data subject to my question:

{"data":{"generatedIds":["4Uz+N55BR2SMxKQWyHOTpA=="]},"success":true,"error":null,"validations":null }

Using YAJL API by Scott Klement and struggling with parsing the JSON data returned from a web service cal. I can successfully read the values for the "data", "generatedIds" and the first and last element of the array. Because the array element does not have a name, I cannot retrieve its value.

node = YAJL_object_find(docNode : 'data');
node = YAJL_object_find(node:'generatedIds');
node = YAJL_ARRAY_ELEM(node:1);
node = YAJL_object_find(node: ___ );
genId = yajl_get_string(node);

Thanks,
Nihat.



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.