我有一个 JSON 对象存储为 php 变量 '$decoded_traces' 解码后的跟踪如下:
{
"Coords": [
{
"Accuracy": "65",
"Latitude": "53.27771684322928",
"Longitude": "-9.01197836634846",
"Timestamp": "Fri Jul 05 2013 11:39:15 GMT+0100 (IST)"
},
{
"Accuracy": "65",
"Latitude": "53.27771684322928",
"Longitude": "-9.01197836634846",
"Timestamp": "Fri Jul 05 2013 11:39:15 GMT+0100 (IST)"
},
{
"Accuracy": "65",
"Latitude": "53.277716230919715",
"Longitude": "-9.01207806014157",
"Timestamp": "Fri Jul 05 2013 11:41:16 GMT+0100 (IST)"
},
{
"Accuracy": "65",
"Latitude": "53.277716230919715",
"Longitude": "-9.01207806014157",
"Timestamp": "Fri Jul 05 2013 11:41:16 GMT+0100 (IST)"
},
{
"Accuracy": "65",
"Latitude": "53.2776809358951",
"Longitude": "-9.012088286120322",
"Timestamp": "Fri Jul 05 2013 11:41:22 GMT+0100 (IST)"
}
]
}
我需要添加另一个名为“图像”的元素/项目/属性,它只是二进制 blob 的文本。所以我需要的是:
{
"Coords": [
{
"Accuracy": "65",
"Latitude": "53.27771684322928",
"Longitude": "-9.01197836634846",
"Timestamp": "Fri Jul 05 2013 11:39:15 GMT+0100 (IST)"
},
{
"Accuracy": "65",
"Latitude": "53.27771684322928",
"Longitude": "-9.01197836634846",
"Timestamp": "Fri Jul 05 2013 11:39:15 GMT+0100 (IST)"
},
{
"Accuracy": "65",
"Latitude": "53.277716230919715",
"Longitude": "-9.01207806014157",
"Timestamp": "Fri Jul 05 2013 11:41:16 GMT+0100 (IST)"
},
{
"Accuracy": "65",
"Latitude": "53.277716230919715",
"Longitude": "-9.01207806014157",
"Timestamp": "Fri Jul 05 2013 11:41:16 GMT+0100 (IST)"
},
{
"Accuracy": "65",
"Latitude": "53.2776809358951",
"Longitude": "-9.012088286120322",
"Timestamp": "Fri Jul 05 2013 11:41:22 GMT+0100 (IST)"
}
],
"Images": [
{
"Image1": "binary",
"Image2": "binary2"
}
]
}
我已经尝试了一些东西,但我真的有点迷路了。显然,在添加之后,我需要再次对其进行编码,以便可以回显它。所有帮助表示赞赏