项目作者: nicoJiang

项目描述 :
A fast json parser which needs just only one traversal of the raw json stream
高级语言: Scala
项目地址: git://github.com/nicoJiang/SmoothJson.git
创建时间: 2018-02-06T07:11:50Z
项目社区:https://github.com/nicoJiang/SmoothJson

开源协议:Apache License 2.0

下载


SmoothJson

A fast json parser which needs just only one traversal of the raw json stream

With SmoothJson, raw json string can be processed in Python style, for example:

Provided that test.json contains content as below:

  1. {
  2. "array" : ["element", false, true, 666, {"key" : "value"}, ["2",3,4]],
  3. "map" : {
  4. "map_inner" : {
  5. "array_inner" : [2, 3, 5, false],
  6. "map_inner_inner" : {
  7. "key_inner_inner_1" : 233,
  8. "key_inner_inner_2" : "555"
  9. }
  10. },
  11. "string" : "my_string",
  12. "boolean" : true,
  13. "double" : 55.675,
  14. "long" : 8237283746374,
  15. "int" : 234
  16. },
  17. "other" : "ffggg"
  18. }

And in python, you may use:

  1. import json
  2. json_object = json.load(open("test.json"))
  3. print json_object["map"]["map_inner"]["array_inner"][3]

Similarly, codes below will generate the same JSONObject:

  1. import com.basic.json.SmoothJson
  2. SmoothJson.load("test.json")
  3. SmoothJson.getJSONObject().valueMap.get("map").valueMap.get("map_inner").valueMap.get("array_inner").valueArray(3).valueBoolean

Enjoy it!