有人可以推荐一种文件格式/ dtd /编程语言,这种语言在语法方面并不太简单/冗长,适合存储分层数据吗?我打算将数据转换为PHP关联数组,以便在运行时使用。这是我用json存储的内容示例,我用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标记,因为所有的open-tag close-tag都没有意义。
有人可以提出别的建议吗?
答案 0 :(得分:0)
我在spyc解析器中使用了yaml ..