Krivahn Doss
Krivahn Doss

Reputation: 155

View json parse object structure in eclipse javascript

I would like to view the json parse objects structure in eclipse. Due to the cross domain issue I am unable to use the console.log() to view the structure in chrome. How else can I view this [object Object] returned structure from Json.Parse ?

Upvotes: 0

Views: 407

Answers (1)

Niccolò Campolungo
Niccolò Campolungo

Reputation: 12042

Use JSON.stringify(object), it will convert your object to a string(then you can alert, write or whatever you want).

EDIT

If this is the returned value from the request:

'{"Date":"05\/25\/2013","Description":"New2","Details":"New2","Item‌​RequestedID":"1343","Picture":,255,217],"Status":1,"User":"2120","Use‌​rName":"Ind1"}'

It is not yet parsed, so you need to use JSON.parse(string) to parse it to a valid JS Object. Once it is parsed, this will be the structure of your object:

{
    "Date": "05\/25\/2013",
    "Description": "New2",
    "Details": "New2",
    "Item‌​RequestedID": "1343",
    "Picture": ,
    255,
    217], "Status": 1,
"User": "2120",
"Use‌​rName": "Ind1"
}
var obj = JSON.parse(result)//where result is the string above and obj is the parsed object with this structure

Then you will be able to access what you need doing obj.Date, obj.Description etc

Upvotes: 2

Related Questions