0
code page="c#"
   { "data":    [{"CUSTOMER_NAME_ID":"INV10143","CUSTOMER_NAME":"rossperry","CUSTOMER_NAME_PAN":"AVRPG4803D","EMAIL":"[email protected]","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

4
  • Please show us what you have tried so far Commented Mar 1, 2017 at 11:25
  • possible duplicate of: stackoverflow.com/questions/9420567/… Commented Mar 1, 2017 at 11:27
  • 1
    Sorry, what do you mean 'there is data'? Why can't you use JSON.parse()? Commented Mar 1, 2017 at 11:29
  • Sorry Everyone,actually I did some mistake thats why I had problem and now I solved it. Commented Mar 5, 2017 at 16:32

3 Answers 3

0

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

Sign up to request clarification or add additional context in comments.

2 Comments

It is giving me error that parsejson is not a function of that one
$.parseJSON is not a function this is what i am getting error when I use this
0
$.ParseJSON(your-string); 

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

Comments

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\":\"[email protected]\",\"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>');

3 Comments

parsedJSON.data is undefined showing me this debugger and only parsed json having all values and i am not able to map into array
Could you add your actual JSON separately to your Question?
Yes I wrote seperately in question ,I updated my question You can check now

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.