PHP改变json格式(先把json转换成数组,处理成另一种样式)
现在的样式:{"project_name":"模板1","project_info":[["项目主标题1","子标题1.1"],["项目主标题2","子标题2.1"]],...
现在的样式:
{"project_name":"模板1","project_info":[["项目主标题1","子标题1.1"],["项目主标题2","子标题2.1"]],"audit_info":[["审核主标题1"
,"子标题1.1"],["审核主标题2","子标题2.1"]],"image_info":[{"title":"身份证信息","val":"http://img.z1231.com/images_201509
/zhitou_img/f_icon01.png"},{"title":"抵押证明","val":"http://img.z1231.com/images_201509/zhitou_img/f_icon04
.png"}]}
改成这种样式:
[
[
{
"title": "审核信息",
"content": [
{
"title": "身份信息已",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon01.png"
},
{
"title": "房产产权证",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon02.png"
},
{
"title": "房产产权证",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon03.png"
},
{
"title": "房产产权证",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon04.png"
},
{
"title": "房产产权证",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon05.png"
},
{
"title": "房产产权证",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon06.png"
}
]
}
],
[
{
"title": "房产信息",
"content": [
{
"title": "房产位置"
},
{
"title": "房产类型"
},
{
"title": "建筑设计"
},
{
"title": "市场参考介绍"
}
]
},
{
"title": "项目介绍"
}
]
] 展开
{"project_name":"模板1","project_info":[["项目主标题1","子标题1.1"],["项目主标题2","子标题2.1"]],"audit_info":[["审核主标题1"
,"子标题1.1"],["审核主标题2","子标题2.1"]],"image_info":[{"title":"身份证信息","val":"http://img.z1231.com/images_201509
/zhitou_img/f_icon01.png"},{"title":"抵押证明","val":"http://img.z1231.com/images_201509/zhitou_img/f_icon04
.png"}]}
改成这种样式:
[
[
{
"title": "审核信息",
"content": [
{
"title": "身份信息已",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon01.png"
},
{
"title": "房产产权证",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon02.png"
},
{
"title": "房产产权证",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon03.png"
},
{
"title": "房产产权证",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon04.png"
},
{
"title": "房产产权证",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon05.png"
},
{
"title": "房产产权证",
"val": "http://img.z1231.com/images_201509/zhitou_img/c_icon06.png"
}
]
}
],
[
{
"title": "房产信息",
"content": [
{
"title": "房产位置"
},
{
"title": "房产类型"
},
{
"title": "建筑设计"
},
{
"title": "市场参考介绍"
}
]
},
{
"title": "项目介绍"
}
]
] 展开
2个回答
展开全部
array(4) {
["project_name"] => string(7) "模板1"
["project_info"] => array(2) {
[0] => array(2) {
[0] => string(16) "项目主标题1"
[1] => string(12) "子标题1.1"
}
[1] => array(2) {
[0] => string(16) "项目主标题2"
[1] => string(12) "子标题2.1"
}
}
["audit_info"] => array(2) {
[0] => array(2) {
[0] => string(16) "审核主标题1"
[1] => string(12) "子标题1.1"
}
[1] => array(2) {
[0] => string(16) "审核主标题2"
[1] => string(12) "子标题2.1"
}
}
["image_info"] => array(2) {
[0] => array(2) {
["title"] => string(15) "身份证信息"
["val"] => string(58) "http://img.z1231.com/images_201509/zhitou_img/f_icon01.png"
}
[1] => array(2) {
["title"] => string(12) "抵押证明"
["val"] => string(58) "http://img.z1231.com/images_201509/zhitou_img/f_icon04.png"
}
}
}
array(2) {
[0] => array(1) {
[0] => array(2) {
["title"] => string(12) "审核信息"
["content"] => array(6) {
[0] => array(2) {
["title"] => string(15) "身份信息已"
["val"] => string(58) "http://img.z1231.com/images_201509/zhitou_img/c_icon01.png"
}
[1] => array(2) {
["title"] => string(15) "房产产权证"
["val"] => string(58) "http://img.z1231.com/images_201509/zhitou_img/c_icon02.png"
}
[2] => array(2) {
["title"] => string(15) "房产产权证"
["val"] => string(58) "http://img.z1231.com/images_201509/zhitou_img/c_icon03.png"
}
[3] => array(2) {
["title"] => string(15) "房产产权证"
["val"] => string(58) "http://img.z1231.com/images_201509/zhitou_img/c_icon04.png"
}
[4] => array(2) {
["title"] => string(15) "房产产权证"
["val"] => string(58) "http://img.z1231.com/images_201509/zhitou_img/c_icon05.png"
}
[5] => array(2) {
["title"] => string(15) "房产产权证"
["val"] => string(58) "http://img.z1231.com/images_201509/zhitou_img/c_icon06.png"
}
}
}
}
[1] => array(2) {
[0] => array(2) {
["title"] => string(12) "房产信息"
["content"] => array(4) {
[0] => array(1) {
["title"] => string(12) "房产位置"
}
[1] => array(1) {
["title"] => string(12) "房产类型"
}
[2] => array(1) {
["title"] => string(12) "建筑设计"
}
[3] => array(1) {
["title"] => string(18) "市场参考介绍"
}
}
}
[1] => array(1) {
["title"] => string(12) "项目介绍"
}
}
}
没看出你这两个json有什么关联,自己json_decode组装去吧
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询