Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] [Not just Javascript] Looping through JSON data should be simple, shouldn't it? [SOLVED]



 Shawn,

Thanks for responding.

I've got a handle on what's going on now.

If you use PHP's json_encode() on a numerical array, then it creates a
JSON with the array syntax that has square brackets.

If you use it on an associative array, then it creates a JSON with
object syntax with squiggly brackets.

I couldn't convert to a numerical array, because I needed the keys to be
named. But I was able to find Javascript syntax that allowed me to loop
through an object.

I got the syntax here among the answers:

http://stackoverflow.com/questions/921789/how-to-loop-through-javascript-object-literal-with-objects-as-members

Keeping track of which levels of the array and which levels of the
object to use to get at the right key or value can be a little tricky.
But it works.

Thanks to everything for the advice and help!

-- 
Dave M G


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links