【发布时间】:2014-04-04 05:03:44
【问题描述】:
我有包含空值的 json。我仍然想捕获那些空值,但是当我使用 json_decode 时,空值在数组中被更改为空。有没有办法在使用 json_decode 后保留空值或将空值更改为空以外的值?
[2] => Array (
[id] => 51136
[key] => 18
[fields] => Array (
[ticket] =>
)
在此数组中,我想将“票证”更改为空白以外的其他内容,或者在使用 json_decode 时保留原始空值也可以。
原始json数据:
"id": "51136",
"key": "18",
"fields": {
"ticket": null,
}
谢谢!
【问题讨论】:
-
null会保留,你能显示你的原始数据吗? -
添加了原始json的sn-p