Bear Bibeault wrote:You still have not answered the question as to why you are doing this in the first place. What's wrong with using the console as intended?
Bear Bibeault wrote:OK, but what has that to do with trying to change what console.log() outputs?
The first thing to do is to fix your JSON. As already pointed out, it makes no sense to have nested lists the way you have.
Also, are you generating the JSON by hand? If so, don't. Let one of the established and debugged JSON libraries generate valid JSON for you.
Michael Matola wrote:It appears that in addition to writing the code that consumes the response, you're also writing the code that processes the request and formats the response. This is a luxurious position to be in -- you get to craft the two to work together exactly as you see fit. So from my standpoint, why are you outputting the data in such an odd format, which is causing you to write torturous, error-prone code with all those i's and k's and u's?
You want to populate two lists with stuff, right? Make it easy on yourself. At the highest level, have two named variables each which point to an array of objects containing your stuff. Then all you initial traversal (and null-checking) of the structure is by named fields.
Better, I hope?