JSON 開發觀念
不要用underline之類的方式來作為JSON的key
如果有多個底線相關的key,就應該考慮用object封裝起來。
{
"SomeKeyTitle": "Value",
"SomeKeyNote": {
"SomeKeyArray": [
{
"someKey_node_id": "Value",
"someKey_list_id": "Value",
"otherKey_type": "Value",
"otherKey_time": "Value",
}
]
},
}
改成
{
"SomeKey": {
"Title": "",
"Notes": {
"Array": [
{
"nodeId": "Value",
"listId": "Value",
"otherKey": {
"type": "Value",
"time": "Value"
}
}
]
}
}
}
既然一個物件裡面只裝著陣列,那爲什麼不直接抽出來將Value作為陣列?
{
"SomeKey": {
"Title": "",
"Notes": [
{
"nodeId": "Value",
"listId": "Value",
"otherKey": {
"type": "Value",
"time": "Value"
}
},
{
xxx
}
]
}
}