If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
"Curiouser and curiouser ..." I would go ahead and serialize l.json_reponse to see what's in there. I would also look over my code very carefully for other types of errors, such as a missing quote or brace that the compiler didn't catch. I've used all these functions in my own work recently, and never had this type of problem.
There is no error on JSON string since decoded any element in JSON object can be accessed.
MIVA_STRUCT_MEMBERS does not recognize JSON array correctly.
MIVA_ARRAY_ELEMENTS recognizes JSON array correctly.
But, it does not distinguish between object structure and ARRAY.
Both MIVA_STRUCT_MEMBERS and MIVA_ARRY_ELEMENTS should be used to determine ARRAY dimension correctly.
I think it's still possible that the problem is in the JSON decoding, not in miva_struct_members or miva_array_elements. Sorry to repeat myself, but that's what I would check in this case
I'm attaching a file with a function that I use for this. (It's very small, but for some reason the forum won't let me paste it into this message.)
It serializes the data, and it also URL-decodes all the values, which makes it much easier to read text that's full of quotes and other punctuation. It works with any type of data, including nested structures of arrays and objects.
Thank you for valuable utility like this.
I will keep in my library.
After all these tests, I concluded that returned JSON data is in valid format.
I was looking for a simple designator which tells me how many candidates exist in response.
Work around is that:
After verifying Candidate element exists,
Check if MIVA_STRUCT_MEMBERS(candidate) returns 0 or not.
If it returns 0, use MIVA_ARRAY_ELEMENTS to find the count
Otherwise, it is single entity.
Comment