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



Nihat,

Array elements never have a name... I don't understand why you want to use yajl_object_find (which is for objects, not arrays)? You already have the node pointer to the array element from calling yajl_array_elem.

Maybe you were just over-thinking this? If you always want the first element of the array, you'd do this:

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

If you want to loop through all elements in the array (such as if there are multiples) you could either call YAJL_ARRAY_ELEM in a loop, or you could use the shortcut routine yajl_array_loop() but that's overkill if you just need the first element.

-SK


On 12/3/2016 2: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.
[https://www.avivasa.com.tr/i/Assets/images//otomatik-katilim-imza-1.jpg]<https://www.avivasa.com.tr/bes-otomatik-katilim-nedir>

Bu e-postanin i?erdigi bilgiler (ekleri dahil olmak ?zere) gizlidir. Onayimiz olmaksizin ???nc? kisilere a?iklanamaz. Bu mesajin g?nderilmek istendigi kisi degilseniz, l?tfen mesaji sisteminizden derhal siliniz. AvivaSA Emeklilik ve Hayat A.S. bu mesajin i?erdigi bilgilerin dogrulugu veya eksiksiz oldugu konusunda bir garanti vermemektedir. Bu nedenle bilgilerin ne sekilde olursa olsun i?eriginden, iletilmesinden, alinmasindan, saklanmasindan sorumlu degildir. Bu mesajin bilinen vir?slere karsi kontrolleri AvivaSA Emeklilik ve Hayat A.S. tarafindan yapilmistir. Ancak internet iletisiminde g?venlik ve hatasiz g?nderim garanti edilemeyeceginden, mesajin yerine ulasmamasi, ge? ulasmasi, i?eriginin bozulmasi ya da mesajin vir?s tasimasi gibi problemler olusabilir. AvivaSA Emeklilik ve Hayat A.S. bu tip sorunlardan sorumlu tutulmaz. Bu mesajin i?erigi yazarina ait olup AvivaSA Emeklilik ve Hayat A.S.'nin g?r?slerini i?ermeyebilir.

The information contained in this e-mail (including any attachments) is confidential. It must not be disclosed to any person without our authority. If you are not the intended recipient, please delete it from your system immediately. AvivaSA Emeklilik ve Hayat A.S. makes no warranty as to the accuracy or completeness of any information contained in this message and hereby excludes any liability of any kind for the information contained therein or for the information transmission, reception, storage or use of such in any way whatsoever. This message is scanned for known viruses by AvivaSA Emeklilik ve Hayat A.S. But Internet communications cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, arrive late or contain viruses. The AvivaSA Emeklilik ve Hayat A.S. therefore does not accept liability for any errors or omissions in the context of this message which arise as a result of Internet transmission. Any opinions expressed in th
is message are those of the author and may not necessarily reflect the opinions of AvivaSA Emeklilik ve Hayat A.S.



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.