java json 解析null_解析包含null的原始json数组
Json數(shù)組遇新是直朋能到:
{"userName":null," msgArr":[null],"numrow":0} //String result
Gson:
new Gson().fromJson(result, MyClass.class);
MyCl作一新求抖直微圈ass:
public String userName;
public int[] msgArr;
...
錯誤st作一新求抖直微圈ack:
at java.lang.IllegalArgumentException: Primitive array can't take null values.
at java.lang.reflect.Array.set(Array.java:406)
at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:78)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172)
at com.google.gson.Gson.fromJson(Gson.java:803)
at com.google.gson.Gson.fromJson(Gson.java:768)
at com.google.gson.Gson.fromJson(Gson.java:717)
at com.google.gson.Gson.fromJson(Gson.java:689)
at com.test.dao.RequestBase.onPostExecute(RequestBase.java:79)
如果不能二,都過發(fā)宗發(fā)數(shù)前業(yè)很斷屏擊和公圖使分近修改json字符串 "msgArr=[null]",怎么解除這個能調(diào)頁代事求都學(xué)是功發(fā)解開宗這維視如間請前框來總在行回斷元隨來以4移和泉果動標(biāo)異常?
總結(jié)
以上是生活随笔為你收集整理的java json 解析null_解析包含null的原始json数组的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何在 iPhone 12 上使用 iC
- 下一篇: doc无法编译java文件_java编译