We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public class Test { public bool boolVal = true; public int intVal = 3; }
Test t = new Test(); t.boolVal = false; t.intVal = 99; var json = CatJson.JsonParser.ToJson(t); Debug.Log(json); /* 输出 { "intVal":99 } / var lt = CatJson.JsonParser.ParseJson(json); Debug.Log(lt.boolVal+" " + lt.intVal); / 输出 True 99 */ 上面boolVal值改成了false 反序列化时值是True
The text was updated successfully, but these errors were encountered:
CatJson.JsonParser.IgnoreDefaultValue = false; 禁用忽略默认值 输出是对的
另外一个问题禁用默认值 string类型必需给一个非null的值能才序列化,不然会报错
Sorry, something went wrong.
使用最新版本V2可以通过JsonCareDefaultValue禁用被标记类型的默认值忽略
No branches or pull requests
public class Test
{
public bool boolVal = true;
public int intVal = 3;
}
Test t = new Test();
t.boolVal = false;
t.intVal = 99;
var json = CatJson.JsonParser.ToJson(t);
Debug.Log(json);
/* 输出
{
"intVal":99
}
/
var lt = CatJson.JsonParser.ParseJson(json);
Debug.Log(lt.boolVal+" " + lt.intVal);
/ 输出
True 99
*/
上面boolVal值改成了false 反序列化时值是True
The text was updated successfully, but these errors were encountered: