views:

155

answers:

2

Is there a way to convert it into object form? So that each field of the result can be accessed results[i].field where i is the number of records in the mysql result..

This is my JSON String http://pastebin.com/Cky1va3K

A: 

if you paste this string serverside into JavaScript code, it is converted automatically.

var myResult = { "result" : /* etc.*/ };
alert(myResult.result[0].REPORT); // see the result
Dormilich
Thanks! The problem was solved.. :)
blacktooth
+2  A: 

Sure. That's what JSON is for, really; it stands for JavaScript Object Notation. A JSON object is a JavaScript object literal.

See the official JSON documentation on using JSON in JavaScript here. Some browsers have native support for JSON parsing (so you don't have to use eval()) and for those that don't, a JavaScript JSON parser is available for download from that page.

Syntactic