824 B
824 B
GJson
实现一个通用的Golang Json对象库
对象模型
- JSONBaseObject 抽象对象,代表所有能够进行JSON序列化和反序列化的对象
- JSONObject JSON Object 继承自JSONBaseObject
- JSONArray JSON Array 继承自JSONBaseObject 代表JSON中的数组类型
- JSONValue 代表简单值对象,子类型包括:JSONString、JSONNumber、JSONBool、JSONNull
功能:
- 序列化/反序列化:对象模型中提到的所有类型都应该实现toJson,fromJson,toString,fromString方法. string和json方法功能一致。
- 对象属性操作功能,应该提供以下函数:
- 获取属性值 getProperty(obj JSONBaseObject, propertyPath string, defaultValue JSONBaseObject)
- 设置属性值 setProperty(obj JSONBaseObject, propertyPath string, value JSONBaseObject)