Giter Site home page Giter Site logo

catjson's Issues

字典不支持枚举为Key吗

///


/// 对比Type是否为同一类型的Type
///

public static bool TypeEquals(Type t1, Type t2)
{
#if FUCK_LUA
t1 = CheckType(t1);
t2 = CheckType(t2);
#endif
return t1 == t2;
}
这个类型判断,如果key是枚举对话,是为非intkey的,会报错

bool类型序列化错误

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

多态序列化格式的疑问

image
看到多态序列化的ToJson步骤,除了1.0版本的RealTypeKey外,额外加入了一层objectKey,实际的对象序列化文本在objectKey对应的value中。
虽然可以理解是为了做多态序列化、反序列化的流程方便,但是这样会导致对象序列化后的json文本没办法在非CatJson环境下被正确反序列化解析(例如客户端ToJson后发送给服务端)

变量作用域问题

hi
偶然发现这个库,在测试 自定义解析器 的过程中发现一个问题,如下:

image

在自定义反序列化时,取值需要用到 Lexer, 但是它的使用范围限定在 internal.

也就是说在反序列化时,在现有设计下是没办法取到值的.

序列化保留

对于字段/属性而言,如果其值为null,false或0,那么为了性能考虑将不会对该字段/属性进行序列化
JsonParser.ToJson 时能加个开关保留 其值为null,false或0 的字段或属性吗
某些情况下可能会用到,比如导出一些游戏设置后,我想要手动把值为false改为true的时,这个字段没了。。还得手动把字段名加上

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.