我们如何在Android中将null定义为数据类型,就像我们在iPhone中定义nsNull一样

Sha*_*hil 8 null android json types

jsonObject.accumulate("status",null);

我想通过空在JSON服务呼叫我尝试的值""," ",NULL,nil,"null"但没有什么帮助

有人可以解决这个问题吗?

Dav*_*jan 6

JSONObject.NULL如果您使用的是org.json,请尝试使用而不是null.

参考文献.

编辑

我试过,用null作为值创建一个json对象,就像这样.

    JSONObject jsonObject = new JSONObject();
    jsonObject.put("Test", JSONObject.NULL);
Run Code Online (Sandbox Code Playgroud)

并且打印时产生的输出是, {"Test": null}

所以,我想这会为你带来魔力.:)