0

I have one query I need to access following JSON data and bind to html table.. but I have done google about it.. but I didn't get any proper output.. so will there be any solution for below nested JSON data..

"{ "ErrorLogCollection": {"ErrorLog": {"CorrelationId": "1823606825", "ErrorMessages": {"Message": {"Blocks": {"EngineState": {"IsStarted": "true" }, "Location": {"IsValid": "true", "Latitude": "16.385044", "Longitude": "18.486671", "PrecisionKilometers": "100" } }, "Header": {"Origin": {"Device": {"DeviceId": "THP20102", "Type": "PL631" } }, "ReferenceId": "4332", "TimestampUtc": "2016-03-03T10:19:10.459Z" }, "PayloadCorrelationId": "1823606825" } }, "ErrorType": "Future Message", "InsertUtc": "2016-03-03T09:18:34.19Z", "PayloadUrl": "https://dev-data.vss-eng.com/TelematicsData/Payload/1823606825/" }, "HasNextPage": "false", "Nav": {"Link": {"href": "https://dev-data.vss-eng.com/TelematicsData/Error/Device/THP20102?fromDate=Sat%20Feb%2027%202016&toDate=Fri%20Mar%2004%202016", "methods": "GET", "rel": "self" } }, "xmlns": "http://www.myvisionlink.com/TelematicsData/Inbound/Error", "xmlns:xsd": "http://www.w3.org/2001/XMLSchema", "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance" }}"

Can anybody know the solution how to parse above JSON.. I have checked other solutions in Stackoverflow ... but it is no use..

regards, raj.

Apb
  • 979
  • 1
  • 8
  • 25
Rajneesh
  • 1
  • 2
  • Did you tried JSON.parse? – gurvinder372 Mar 04 '16 at 07:28
  • yes i have done JSON.parse, but it again return the inner object here it return ErrorLogCollection, actually i need to loop through the elements and bind specific elements to html table, but i have done but no use. – Rajneesh Mar 04 '16 at 08:36
  • Possible duplicate of [How to access nested JSON data](http://stackoverflow.com/questions/9463233/how-to-access-nested-json-data) – apollo Mar 04 '16 at 13:24

1 Answers1

0

If you have tried JSON.parse or jQuery.parseJSON or some tool like this but still fail, maybe it is not tool issue and it is about how you get the data.

it should be like: JSON.parse('{ "ErrorLogCollection":.....}')

Not JSON.parse("{ "ErrorLogCollection":.....}") nor JSON.parse('"{ "ErrorLogCollection":.....}"')

melson.jao
  • 204
  • 1
  • 6
  • my issue is how to parse this nested json data (which is posted above) and get some specific elements data and bind to html.. just tell me how to get or parse particualar elements(Errorlog, errormessage,device, inserutc, correlationId,..) – Rajneesh Mar 04 '16 at 09:30
  • can anybody please tell me how to access inner elements of json data ? – Rajneesh Mar 05 '16 at 10:01