0
有人可以推薦一種文件格式/ dtd /編程語言,當涉及到語法時,它不是非常簡單/冗長,適用於存儲分層數據嗎?我打算將數據轉換爲一個PHP關聯數組,供運行時使用。這裏的內容我使用JSON存儲我用PHP讀取並轉換爲一個PHP關聯數組的例子:好的方法來存儲將被轉換爲PHP數組的數據?
{
"variable":{
"bp":{"label":"Blood Pressure", "display":1, "units":"mmHG", "is_number":true, "default":0},
"rr":{"label":"Resting Rate", "display":1, "units":"bpm", "is_number":true, "default":0},
"k":{"label":"Potassium", "display":1, "units":"grams", "is_number":true, "default":0}
},
"content":{
"investigations":{
"label":"Investigations",
"type":"panel1",
"options":{
"clinical_assessment":{
"label":"Clinical Assessment",
"type":"panel2",
"options":{
"general_appearance":{
"label":"General Appearance",
"type":"action"
},
"vital_signs":{
"label":"Vital Signs",
"type":"action"
}
}
},
"capillary_blood_glucose":{
"label":"Capillary Blood Glucose",
"type":"panel2",
"options":{
"now":{
"label":"now",
"type":"action"
},
"every_30_minutes":{
"label":"Every 30 minutes",
"type":"action"
},
"every_1_hour":{
"label":"Every 1 hour",
"type":"action"
}
}
},
"laboratory_investigations":{
"label":"Laboratory Investigations",
"type":"panel3",
"options":{
"biochemistry":{
"label":"Biochemistry",
"type":"panel2",
"options":{
"arterial_blood_gas":{
"label":"Arterial Blood Gas",
"type":"action"
},
"albumin":{
"label":"Albumin",
"type":"action"
}
}
},
"haematology":{
"label":"Haematology",
"type":"panel2",
"options":{
"blood_smear":{
"label":"Blood Smear",
"type":"action"
}
}
}
}
}
}
},
"management":{
"label":"Management",
"type":"panel1",
"options":{
"iv_fluids":{
"label":"IV Fluids",
"type":"",
"options":{
}
},
"potassium_chloride":{
"label":"Potassium Chloride",
"type":"",
"options":{
}
},
"insulin":{
"label":"Insulin",
"type":"",
"options":{
}
}
}
}
}
}
什麼我不喜歡上面的是,我不能添加//comments
當我錯過逗號,<?php json_decode($jsoncontent); ?>
失敗。我試圖把它作爲一個PHP關聯數組來存儲,但是缺乏數組速記符號真的讓我惱火。我不喜歡XML標記,因爲所有開放標籤的關閉標籤都是無意義的。
有人可以提出其他建議嗎?