php匿名类与索引重建
本文主要介绍匿名类与索引重建在 json 编码方面的一些小技巧 问题 将下面源数据结构 json 转为目标 json 源 json 数据 { "code": 200, "message": "操作成功", "data": [ { "id": 1, "goods_id": 1, "property_name_id": 1, "property_value_id": 1, "property_name": { "title": "份量", "is_sale": true }, "property_value": { "id": 1, "value": "小份", "image": "" } }, { "id": 2, "goods_id": 1, "property_name_id": 1, "property_value_id": 2, "property_name": { "title": "份量", "is_sale": true }, "property_value": { "id": 2, "value": "中份", "image": "" } }, { "id": 3, "goods_id": 1, "property_name_id": 2, "property_value_id": 4, "property_name": { "title": "温度", "is