在JS或jQuery中解析复杂的JSON [英] Parsing Complex JSON in JS or jQuery
本文介绍了在JS或jQuery中解析复杂的JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何用jQuery或JSON解析这个JSON?
How to parse this JSON in jQuery or JSON?
示例:
{
"Travel": {
"Transport_type": "Road",
"Options": {
"Destination": "Delhi",
"BusType": "Volvo",
"Time": "Night",
},
"Carrier": {
"Private": {
"Service_Provider": "Sharma",
"Features": {
"Seats": "PushBack",
"Indoor Pantry": "Available",
}
},
}
}
}
我无法使用 json.parse
函数来获取结果。
I'm not able to use the json.parse
function to get the results.
推荐答案
只要你有一个有效的JSON字符串,就可以使用javascript函数JSON.parse()或使用jQuery函数解析 - jQuery.parseJSON()。
As long as you have a valid JSON string, you can parse using javascript function JSON.parse() or using jQuery function - jQuery.parseJSON().
请先验证您的JSON字符串。
Please validate your JSON string first.
这篇关于在JS或jQuery中解析复杂的JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文