JSON输入:
k = 2; //<== random input
while (*s != '\0')
{
printf("count %d\n", count);
char a = *(s + k);
...
}
使用JsonDeserializer进行API调用
s
而且,班级
char a
我做错了什么?结果总是&#34; NullReferenceException:对象引用未设置为对象的实例&#34; ...
答案 0 :(得分:1)
您有两个选项可以将您尝试序列化的对象更改为:
IRestResponse<List<Class1>> response = client.Execute<List<Class1>>(request);
或者将你的Json修改为
{
"Property1" : [
{
"entity":{
"type":"postcode",
"id":"P11516",
"label":"18314 Divitz-Spoldershagen",
"value":"18314"
},
"matches":[
{
"offset":0,
"length":5
}
]
},
{
"entity":{
"type":"postcode",
"id":"P11541",
"label":"18314 Kenz-Küstrow",
"value":"18314"
},
"matches":[
{
"offset":0,
"length":5
}
]
},
{
"entity":{
"type":"postcode",
"id":"P11549",
"label":"18314 Löbnitz",
"value":"18314"
},
"matches":[
{
"offset":0,
"length":5
}
]
},
{
"entity":{
"type":"postcode",
"id":"P11551",
"label":"18314 Lüdershagen",
"value":"18314"
},
"matches":[
{
"offset":0,
"length":5
}
]
}
]
}
如果您修改了json,请立即离开序列化调用。