在 Ext JS 4 或 JavaScript 中解析 JSON

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14755657/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 22:29:54  来源:igfitidea点击:

Parse JSON in Ext JS 4 or JavaScript

javascriptextjsextjs4extjs-mvc

提问by anupkumar

I have this type of JSON:

我有这种类型的JSON

{"value":[{"idProductCategoryAttributeValue":43,"value":"7","sortOrder":0}]}

I want the individual parameters values like. How do I parse this JSON string in Ext JS4 or in simple JavaScript?

我想要单个参数值,例如。如何在Ext JS4 或简单的 JavaScript 中解析这个 JSON 字符串?

回答by devOp

Have a look at http://docs.sencha.com/ext-js/4-1/#!/api/Ext.JSON. There you find how you can parse JSON with Ext JS 4.

看看http://docs.sencha.com/ext-js/4-1/#!/api/Ext.JSON。在那里,您将了解如何使用 Ext JS 4 解析 JSON。

var strJson = '{"value": [{"idProductCategoryAttributeValue":43,"value":"7","sortOrder":0}]}';
var obj = Ext.JSON.decode(strJson);

回答by Vlad

var obj = Ext.decode(jsonstr);