I have json element
{"element":{},
"gallery":{
"images":[
{"id":"1","description":{},"image_path":"1.jpg"},
{"id":"2","description":"Test","image_path":"2.jpg"}
]},
"additional_value":"Test"}
php function json_decode($json, TRUE) return
Array
(
[element] => Array()
[gallery] => Array(
[images] => Array(
[0] => Array(
[id] => 1
[description] => Array()
[image_path] => 1.jpg)
[1] => Array(
[id] => 2
[description] => Test
[image_path] => 2.jpg)
)
)
[additional_value] => Test
)
How I can replace/convert empty arrays to string? For example:
[0] => Array([id] => 1
[description] => ""
[image_path] => 1.jpg)
Thank you!
descriptionbeing set to a JSON object you will have to do the conversion manually in PHP.array_walk_recursive().