c# - 从 json 格式对象获取值

标签 c# javascript

在我的 asp.Net 应用程序 (MVC 3) 中的 View 中,我正在使用一些 jquery 控件。我得到了 json

 {  
        "text":"Books",  
        "state":"open",  
        "attributes":{  
            "url":"/demo/book/abc",  
            "price":100  
        }    

如何获取属性值?

最佳答案

我认为你需要

var json =  {   
    "text":"Books",   
    "state":"open",   
    "attributes":{   
        "url":"/demo/book/abc",   
        "price":100   
    } 

json.attributes.url

例如。

关于c# - 从 json 格式对象获取值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11984845/

相关文章:

javascript - 为什么我可以在 `ng-bind` 之外使用 `ng-app` ?

javascript - 显示正在加载图像直到 div 完全加载

c# - 如何同时刷新局部 View 和主视图?

c# - 在 JSON 对象的属性中存储 JSON 对象

c# - 为什么我们不需要动态语言的接口(interface)?

javascript - 检查是否选中任何单选按钮,然后执行代码(多组按钮)

c# - 添加到数据库后访问对象属性

c# - 向上转换为通用类型

javascript - 区间树 : Uncaught TypeError: Cannot read property 'mid' of null

javascript - 关闭后如何清除模态中的 react 状态?