简体   繁体   English

如何从返回jsonresult的mvc访问嵌套的json数据

[英]how to access nested json data comin from mvc which returns jsonresult

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.. 我有一个查询,我需要访问以下JSON数据并绑定到html表..但是我已经完成了google工作..但是我没有得到任何正确的输出..所以下面的嵌套JSON数据是否有任何解决方案。 。

"{ "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" “ {” ErrorLogCollection“:{” ErrorLog“:{” CorrelationId“:” 1823606825“,” ErrorMessages“:{” Message“:{” Blocks“:{” EngineState“:{” IsStarted“:” true“},”位置”:{“ IsValid”:“ true”,“纬度”:“ 16.385044”,“经度”:“ 18.486671”,“精密千米”:“ 100”}},“标头”:{“来源”:{“设备“:{” DeviceId“:” THP20102“,” Type“:” PL631“}},” ReferenceId“:” 4332“,” TimestampUtc“:” 2016-03-03T10:19:10.459Z“},” PayloadCorrelationId“ :“” 1823606825“}},” ErrorType“:”未来消息“,” 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/错误/设备/ THP20102?fromDate = Sat%20Feb%2027%202016&toDate = Fri%20Mar%2004%202016“,”方法“:” 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.. 谁能知道解决方案如何解析上面的JSON ..我已经检查了Stackoverflow中的其他解决方案...但是没有用。

regards, raj. 问候,raj。

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. 如果您尝试使用JSON.parse或jQuery.parseJSON或类似工具但仍然失败,则可能不是工具问题,而是关于如何获取数据的问题。

it should be like: JSON.parse('{ "ErrorLogCollection":.....}') 它应该像这样:JSON.parse('{“ ErrorLogCollection”:.....}')

Not JSON.parse("{ "ErrorLogCollection":.....}") nor JSON.parse('"{ "ErrorLogCollection":.....}"') 不是JSON.parse(“ {” ErrorLogCollection“:.....}”)也不是JSON.parse('“ {” ErrorLogCollection“:.....}”')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM