分层数据的平面或嵌套JSON?
我已经来回切换了约5次。这个REST端点/api/tags/仅供内部使用(没有第三方客户端),我是唯一使用它的人。 我要在这两种表示形式之间做出决定: 平面 { "types":[ { "id":1, "text":"Utility" }, { "id":7, "text":"Lease Terms" }, ], "tags":[ { "id":8, "text":"Water", "type":1 }, { "id":9, "text":"Electricity", "type":1 }, { "id":5, "text":"Minimum 12 month lease", "type":7 }, { "id":17, "text":"lease negotiable/flexible", "type":7 }, ] } 它有点模块化。可以添加另一个顶层,例如“国家/地区”而不会破坏兼容性。 巢状 { "1":{ "text":"Utility", "tags":{ "8":{ "text":"Water" …