Json解码删除null和0 [英] Json decode removes null and 0
本文介绍了Json解码删除null和0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用json_decode($ content,true)将json字符串解码为php数组。我发现null值已经转换为空格。然后我通过
来管理它if if($ cell =='')
{
$ values。='Null,';
}
但我发现son_decode也删除了零。我如何从json_decode中将零作为零并将null作为null。有什么帮助吗?
我尝试过:
json_decode($ content,true)
if($ cell =='')
{
$ values。='Null,';
}
解决方案
content,true)将json字符串解码为php数组。我发现null值已经转换为空格。然后我通过
来管理它if(
cell =='')
{
values。='Null,';
}
但我发现son_decode也删除了零。我如何从json_decode中将零作为零并将null作为null。有什么帮助吗?
我尝试过:
json_decode(
I use json_decode($content, true) to decode json string to php array. I found null value has been converted to white space. Then I manage it through
if ($cell=='') { $values .= 'Null,'; }
But I found that son_decode removes zero also. How do I get zero as zero and null as null from json_decode. Any help?
What I have tried:
json_decode($content, true) if ($cell=='') { $values .= 'Null,'; }
解决方案
content, true) to decode json string to php array. I found null value has been converted to white space. Then I manage it through
if (
cell=='') {
values .= 'Null,'; }
But I found that son_decode removes zero also. How do I get zero as zero and null as null from json_decode. Any help?
What I have tried:
json_decode(
这篇关于Json解码删除null和0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文