gjson/doc/require.md

824 B
Raw Blame History

GJson

实现一个通用的Golang Json对象库

对象模型

  1. JSONBaseObject 抽象对象代表所有能够进行JSON序列化和反序列化的对象
  2. JSONObject JSON Object 继承自JSONBaseObject
  3. JSONArray JSON Array 继承自JSONBaseObject 代表JSON中的数组类型
  4. JSONValue 代表简单值对象子类型包括JSONString、JSONNumber、JSONBool、JSONNull

功能:

  1. 序列化/反序列化对象模型中提到的所有类型都应该实现toJson,fromJson,toString,fromString方法. string和json方法功能一致。
  2. 对象属性操作功能,应该提供以下函数:
    1. 获取属性值 getProperty(obj JSONBaseObject, propertyPath string, defaultValue JSONBaseObject)
    2. 设置属性值 setProperty(obj JSONBaseObject, propertyPath string, value JSONBaseObject)