我有这个JSON在我的应用程序的AJAX请求返回,迭代通过组
{"info": {"pat_gender": "f",
"obtained_pmh": true,
"organized": false,
"hpi_selected_alleviating": true,
"greeted_patients": true,
"echoed_patients_words": false,
"allowed_pt_to_finish_thoughts": true,
"grade": "Excellent"
} }
我想通过项目,但在小组循环排序真假领域,即一个JSON
{"info": {
"pat_gender": "f",
//from here GROUP1
"obtained_pmh": true,
"organized": false,
"hpi_selected_alleviating": true,
//GROUP2
"greeted_patients": true,
"echoed_patients_words": false,
"allowed_pt_to_finish_thoughts": true,
"grade": "Excellent"
} }
我想有两个列表(true和false)进行分类第1组的领域,也第2组排序以同样的方式。 我该如何做到最好?
JS对象(以及扩展名为JSON字典)没有内置的“按键顺序”的概念。您需要按照您想要检查的顺序拥有自己的字段列表。但是,在这种情况下,“排序”是什么意思? – cHao 2013-03-14 15:46:27
@cHao在排序中,我的意思是在每个组中创建两组字段,将字段分隔为T和F. – Alexxio 2013-03-14 18:26:10