本文介绍了如何在JSON响应中获取第一个孩子的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

var jsonresponse ='{GetCategoryListResult:[{ErrorMessage:null,SR_Category_Desc:出价过程(准确性),SR_Category_Id:1},{ErrorMessage:null,SR_Category_Desc :及时付款应用程序\ /准确,SR_Category_Id:2},{ErrorMessage:null,SR_Category_Desc:遵守价格作为出价,SR_Category_Id:3},{ ErrorMessage:null,SR_Category_Desc:遵守合同计划,SR_Category_Id:4},{ErrorMessage:null,SR_Category_Desc:能够按时完成工作,SR_Category_Id :5},{ErrorMessage:null,SR_Category_Desc:变更单声明,SR_Category_Id:6},{ErrorMessage:null,SR_Category_Desc:客户服务(办公室职员) ,SR_Category_Id:7},{ErrorMessage:null,SR_Category_Desc:客户服务(现场工作人员),SR_Category_Id:8},{ErrorMessage:null,SR_Category_Desc :产品质量,SR_Category_Id:9},{ErrorMessage:null,SR_Category_Desc:工艺质量,SR_Category_Id:10},{ErrorMessage: null,SR_Category_Desc:遵守安全,SR_Category_Id:11},{ErrorMessage:null,SR_Category_Desc:整体性能,SR_Category_Id:12},{ErrorMessage :null,SR_Category_Desc:全职主管监督,SR_Category_Id:13},{ErrorMessage:null,SR_Category_Desc:子付款问题,SR_Category_Id:14 },{ErrorMessage:null,SR_Category_Desc:管理合作\ /响应性,SR_Category_Id:15},{ErrorMessage:null,SR_Category_Desc:文档的周转时间\ /文书工作包括合同,保险和变更单等,SR_Category_Id:16},{ErrorMessage:null,SR_Category_Desc:语音邮件的转发时间\ /电子邮件, SR_Category_Id:17},{ErrorMessage:null,SR_Category_Desc:规划\ /调度\ /协调人工,SR_Category_Id:18},{ErrorMessage:null, SR_Category_Desc:计划\ /计划\ /材料协调,SR_Category_Id:19},{ErrorMessage:nu ll,SR_Category_Desc:努力改进工作并自愿接受变更,SR_Category_Id:20},{ErrorMessage:null,SR_Category_Desc:与其他现场潜艇的工作关系,SR_Category_Id :21},{ErrorMessage:null,SR_Category_Desc:租用员工,SR_Category_Id:22},{ErrorMessage:null,SR_Category_Desc:保险符合合同并及时提交,SR_Category_Id:23},{ErrorMessage:null,SR_Category_Desc:management\ / staff的可访问性,SR_Category_Id:24},{ErrorMessage:null,SR_Category_Desc :他们做他们说他们会做的事情,SR_Category_Id:25}}}';



如何才能获得以下内容,谢谢提前



[{ErrorMessage:null,SR_Category_Desc:出价过程(准确性),SR_Category_Id:1},{ErrorMessage :null,SR_Category_Desc:及时付款应用程序\ /准确,SR_Category_Id:2},{ErrorMessage:null,SR_Category_Desc:坚持价格为双d,SR_Category_Id:3},{ErrorMessage:null,SR_Category_Desc:遵守合同计划,SR_Category_Id:4},{ErrorMessage:null,SR_Category_Desc: 能够按时完成工作,SR_Category_Id:5},{ErrorMessage:null,SR_Category_Desc:变更单声明,SR_Category_Id:6},{ErrorMessage: null,SR_Category_Desc:客户服务(办公室职员),SR_Category_Id:7},{ErrorMessage:null,SR_Category_Desc:客户服务(现场工作人员),SR_Category_Id:8 },{ErrorMessage:null,SR_Category_Desc:产品质量,SR_Category_Id:9},{ErrorMessage:null,SR_Category_Desc:工艺质量,SR_Category_Id: 10},{ErrorMessage:null,SR_Category_Desc:遵守安全,SR_Category_Id:11},{ErrorMessage:null,SR_Category_Desc:整体性能,SR_Category_Id :12},{ErrorMessage:null,SR_Category_Desc:全职主管监督,SR_Category_Id:13},{ErrorMessage:null,SR_Category_Desc:子潜艇付款问题,SR_Category_Id:14},{ErrorMessage:null,SR_Category_Desc:管理合作\ /响应性,SR_Category_Id:15},{ErrorMessage:null,SR_Category_Desc :文档数量/文书工作的周转时间,包括合同,保险和变更单等,SR_Category_Id:16},{ErrorMessage:null,SR_Category_Desc:周转时间on voicemails\ / emails,SR_Category_Id:17},{ErrorMessage:null,SR_Category_Desc:规划\ /调度\ /协调人工,SR_Category_Id:18} ,{ErrorMessage:null,SR_Category_Desc:Planning \ / Scheduling \ / Coordination of Materials,SR_Category_Id:19},{ErrorMessage:null,SR_Category_Desc:努力改进在工作中并随意接受变更,SR_Category_Id:20},{ErrorMessage:null,SR_Category_Desc:与其他现场潜艇的工作关系,SR_Category_Id:21},{ErrorMessage :null,SR_Category_Desc:租用员工,SR_Category_Id:22},{ErrorMessage :null,SR_Category_Desc:保险符合合同并及时提交,SR_Category_Id:23},{ErrorMessage:null,SR_Category_Desc:管理层的可访问性/工作人员,SR_Category_Id :24},{ErrorMessage:null,SR_Category_Desc:他们做他们说他们会做什么,SR_Category_Id:25}]

var jsonresponse = '{"GetCategoryListResult":[{"ErrorMessage":null,"SR_Category_Desc":"Bidding Process (accuracy)","SR_Category_Id":"1"},{"ErrorMessage":null,"SR_Category_Desc":"Timely Payments applications \/accurate","SR_Category_Id":"2"},{"ErrorMessage":null,"SR_Category_Desc":"Adherence to Price as bid","SR_Category_Id":"3"},{"ErrorMessage":null,"SR_Category_Desc":"Adherence to contract schedule","SR_Category_Id":"4"},{"ErrorMessage":null,"SR_Category_Desc":"Ability to complete work on-time","SR_Category_Id":"5"},{"ErrorMessage":null,"SR_Category_Desc":"Change Order claims","SR_Category_Id":"6"},{"ErrorMessage":null,"SR_Category_Desc":" Customer Service (office staff)","SR_Category_Id":"7"},{"ErrorMessage":null,"SR_Category_Desc":" Customer Service (field staff)","SR_Category_Id":"8"},{"ErrorMessage":null,"SR_Category_Desc":" Quality of Products","SR_Category_Id":"9"},{"ErrorMessage":null,"SR_Category_Desc":" Quality of Workmanship","SR_Category_Id":"10"},{"ErrorMessage":null,"SR_Category_Desc":" Adherence to Safety","SR_Category_Id":"11"},{"ErrorMessage":null,"SR_Category_Desc":" Overall Performance","SR_Category_Id":"12"},{"ErrorMessage":null,"SR_Category_Desc":" Full-time competent Supervision","SR_Category_Id":"13"},{"ErrorMessage":null,"SR_Category_Desc":" Sub of a sub payment issues","SR_Category_Id":"14"},{"ErrorMessage":null,"SR_Category_Desc":" Management Cooperation\/Responsiveness","SR_Category_Id":"15"},{"ErrorMessage":null,"SR_Category_Desc":" Turn-around time on documentation\/paperwork including contracts, insurance, and change orders,etc","SR_Category_Id":"16"},{"ErrorMessage":null,"SR_Category_Desc":" Turn-around time on voicemails\/emails","SR_Category_Id":"17"},{"ErrorMessage":null,"SR_Category_Desc":" Planning\/Scheduling\/Coordination of Labor","SR_Category_Id":"18"},{"ErrorMessage":null,"SR_Category_Desc":" Planning\/Scheduling\/Coordination of Materials","SR_Category_Id":"19"},{"ErrorMessage":null,"SR_Category_Desc":" Strived for improvement in work and accepts change willingly","SR_Category_Id":"20"},{"ErrorMessage":null,"SR_Category_Desc":" Working relationship with other onsite subs","SR_Category_Id":"21"},{"ErrorMessage":null,"SR_Category_Desc":" Leased employees","SR_Category_Id":"22"},{"ErrorMessage":null,"SR_Category_Desc":" Insurance complies with contract and submitted timely","SR_Category_Id":"23"},{"ErrorMessage":null,"SR_Category_Desc":" Accessibility of management\/staff","SR_Category_Id":"24"},{"ErrorMessage":null,"SR_Category_Desc":" Do they do what they say they will do","SR_Category_Id":"25"}]}';

How can get only the following, Thanks in advance

[{"ErrorMessage":null,"SR_Category_Desc":"Bidding Process (accuracy)","SR_Category_Id":"1"},{"ErrorMessage":null,"SR_Category_Desc":"Timely Payments applications \/accurate","SR_Category_Id":"2"},{"ErrorMessage":null,"SR_Category_Desc":"Adherence to Price as bid","SR_Category_Id":"3"},{"ErrorMessage":null,"SR_Category_Desc":"Adherence to contract schedule","SR_Category_Id":"4"},{"ErrorMessage":null,"SR_Category_Desc":"Ability to complete work on-time","SR_Category_Id":"5"},{"ErrorMessage":null,"SR_Category_Desc":"Change Order claims","SR_Category_Id":"6"},{"ErrorMessage":null,"SR_Category_Desc":" Customer Service (office staff)","SR_Category_Id":"7"},{"ErrorMessage":null,"SR_Category_Desc":" Customer Service (field staff)","SR_Category_Id":"8"},{"ErrorMessage":null,"SR_Category_Desc":" Quality of Products","SR_Category_Id":"9"},{"ErrorMessage":null,"SR_Category_Desc":" Quality of Workmanship","SR_Category_Id":"10"},{"ErrorMessage":null,"SR_Category_Desc":" Adherence to Safety","SR_Category_Id":"11"},{"ErrorMessage":null,"SR_Category_Desc":" Overall Performance","SR_Category_Id":"12"},{"ErrorMessage":null,"SR_Category_Desc":" Full-time competent Supervision","SR_Category_Id":"13"},{"ErrorMessage":null,"SR_Category_Desc":" Sub of a sub payment issues","SR_Category_Id":"14"},{"ErrorMessage":null,"SR_Category_Desc":" Management Cooperation\/Responsiveness","SR_Category_Id":"15"},{"ErrorMessage":null,"SR_Category_Desc":" Turn-around time on documentation\/paperwork including contracts, insurance, and change orders,etc","SR_Category_Id":"16"},{"ErrorMessage":null,"SR_Category_Desc":" Turn-around time on voicemails\/emails","SR_Category_Id":"17"},{"ErrorMessage":null,"SR_Category_Desc":" Planning\/Scheduling\/Coordination of Labor","SR_Category_Id":"18"},{"ErrorMessage":null,"SR_Category_Desc":" Planning\/Scheduling\/Coordination of Materials","SR_Category_Id":"19"},{"ErrorMessage":null,"SR_Category_Desc":" Strived for improvement in work and accepts change willingly","SR_Category_Id":"20"},{"ErrorMessage":null,"SR_Category_Desc":" Working relationship with other onsite subs","SR_Category_Id":"21"},{"ErrorMessage":null,"SR_Category_Desc":" Leased employees","SR_Category_Id":"22"},{"ErrorMessage":null,"SR_Category_Desc":" Insurance complies with contract and submitted timely","SR_Category_Id":"23"},{"ErrorMessage":null,"SR_Category_Desc":" Accessibility of management\/staff","SR_Category_Id":"24"},{"ErrorMessage":null,"SR_Category_Desc":" Do they do what they say they will do","SR_Category_Id":"25"}]

推荐答案


var responseObject = JSON.parse(jsonresponse);

var theArrayIWant = responseObject.GetCategoryListResult;


这篇关于如何在JSON响应中获取第一个孩子的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 12:57