0
code page="c#"
   { "data":    [{"CUSTOMER_NAME_ID":"INV10143","CUSTOMER_NAME":"rossperry","CUSTOMER_NAME_PAN":"AVRPG4803D","EMAIL":"rossperry1@gmail.com","PLAN_NAME":"MOSt special Plan   Growth","DATE":"\/Date(1452452300000)\/","AMOUNT":5000.0000,"CONFIRM_UNITS":314.832}]}

THis is what I am getting after parsing string into json object but I am not able to map into array.actually I am getting data after parsing which I mentioned aboove how csan i get object.why giving me error that obj.data undefined

ziel
  • 127
  • 2
  • 11

3 Answers3

0

You can use $.ParseJSON(string) for converting json string to array.

hamed
  • 7,939
  • 15
  • 60
  • 114
0
$.ParseJSON(your-string); 

parseJSON was added in version 1.4.1, so if you're using earlier versions, it's not there.

Dhruti
  • 37
  • 2
  • 10
0

Not sure if you've got a typo in your question but JSON doesn't look valid.

If however it is valid then you'll want something like:

var parsedJSON = JSON.parse("{ \"data\": [object1, object2] }");
var array = parsedJSON.data;

UPDATE

After formatting your updated JSON everything looks ok. Not sure why you're getting undefined

var json = "{\"data\":[{\"CUSTOMER_NAME_ID\":\"INV10143\",\"CUSTOMER_NAME\":\"rossperry\",\"CUSTOMER_NAME_PAN\":\"AVRPG4803D\",\"EMAIL\":\"rossperry1@gmail.com\",\"PLAN_NAME\":\"MOSt special Plan   Growth\",\"DATE\":\"/Date(1452452300000)/\",\"AMOUNT\":5000,\"CONFIRM_UNITS\":314.832}]}"

var parsedJSON = JSON.parse(json);
document.write('<pre><code>' + JSON.stringify(parsedJSON.data,null,2) + '</code></pre>');
phuzi
  • 12,078
  • 3
  • 26
  • 50
  • parsedJSON.data is undefined showing me this debugger and only parsed json having all values and i am not able to map into array – ziel Mar 03 '17 at 05:43
  • Could you add your actual JSON separately to your Question? – phuzi Mar 03 '17 at 06:10
  • Yes I wrote seperately in question ,I updated my question You can check now – ziel Mar 03 '17 at 06:40