我在修改PHP数组并将其转换为JSON对象时遇到问题。数组通过MySQL查询形成。
所需的JSON格式如下:
[{
"id":101,
"text":"Bank / Kas",
"children":[{
"id":101.1,
"text":"Bank",
"children":[{
"id":101.11,
"text":"Bank Bca",
"children":[{
"id":101.111,
"text":"Bank Sayangan"
}]
},{
"id":101.12,
"text":"Bank BNI"
}]
},{
"id":101.2,
"text":"Kas",
"state":"closed",
"children":[{
"id":101.21,
"text":"Kas Besar"
},{
"id":101.22,
"text":"Kas Kecil"
}]
}]
}]