【发布时间】:2015-03-02 14:48:11
【问题描述】:
我在网上查看过,但无法找到有关我所遇到问题的详细答案。我有一个看起来像这样的对象:
{
"00001": {
"sid": "00001",
"oid": "00001",
"name": "operation 0001 service 1",
"description": "test operation 000001",
"returntype": "something",
"parameters": {
"00001": {
"pid": "00001",
"name": "parameter 00001 operation 0001 service 1",
"description": "test parameter 000001",
"type": "something"
}
}
},
"00002": {
"sid": "00002",
"oid": "00002",
"name": "operation 0001 service 2",
"description": "test operation 000001",
"returntype": "something",
"parameters": {}
},
"00003": {
"sid": "00003",
"oid": "00003",
"name": "operation 0001 service 3",
"description": "test operation 000001",
"returntype": "something",
"parameters": {}
},
"00004": {
"sid": "00004",
"oid": "00004",
"name": "operation 0001 service 4",
"description": "test operation 000001",
"returntype": "something",
"parameters": {}
},
"00005": {
"sid": "00005",
"oid": "00005",
"name": "operation 0001 service 5",
"description": "test operation 000001",
"returntype": "something",
"parameters": {}
},
"00006": {
"sid": "00001",
"oid": "00006",
"name": "operation 0001 service 6",
"description": "test operation 000001",
"returntype": "something",
"parameters": {}
}
}
我正在尝试遍历对象并能够返回具有特定 sid(即 00001)的对象 我知道在 javascript 中有一个 for var in obj,但我不确定如何按顺序实现它获得所需的输出。任何帮助或指导将不胜感激。
【问题讨论】:
标签: javascript loops object properties