我有一些
JSON我想要反序列化,但我想将其中一个属性视为字符串,而不是对象.
作为一个例子,JSON看起来像这样:
{ "name":"Frank","sex":"male","address": { "street":"nowhere st","foo":"bar" } }
我想将它反序列化为此对象 – 将地址对象视为字符串文字:
public class Person { public string name; public string sex; public string address; }
我已经尝试将字符串反序列化到此对象,但得到错误:
无法将JSON对象反序列化为“System.String”类型.
有任何想法吗?
干杯