【发布时间】:2019-03-01 04:17:57
【问题描述】:
我有一个对 php 服务器的 android 请求,它以 JSON 格式发送一个关联的数组,如何通过改造或 volley 将其解析为模型或其他方式? 像这样的 JSON 响应:
{
"d": {
"240": {
"title": "First floor",
"rooms": {
"246": {
"title": "kitchen",
"type": 1,
"hid": 246
},
"251": {
"title": "room56",
"type": 3,
"hid": 251
}
}
},
"389": {
"title": "Second floor",
"rooms": {
"390": {
"title": "First room",
"type": 2,
"hid": 390
}
}
}
}
}
【问题讨论】:
-
你只是想把它变成一个数组?
json_decode($array, true); -
正确拼写解析并格式化 JSON,使其可读
标签: php android json web-services associative-array