GitHub - sainttttt/gemmaJSON: JSON parser library for Nim based on simdjson bindings

Test was for deserialization of reddit comment json dumps, checking if the entry was from a specific subreddit

var jsonObj = parseGemmajsonObj("""{"cat": {"a": ["woof", ["meow"], 2]}}""")

echo jsonObj.getStr("/cat/a/0")
# woof

echo jsonObj.getStr("/cat/a/1/0")
# meow

echo $jsonObj["cat"]["a"][0]
# woof

echo $jsonObj
# {"cat":{"a":["woof",["meow"],2]}}

var j = jsonObj.toJsonNode.pretty
echo j.pretty

# {
#   "cat": {
#     "a": [
#       "woof",
#       [
#         "meow"
#       ],
#       2
#     ]
#   }
# }

for e in jsonObj.getElement("/cat/a"):
  echo $e

# woof
# ["meow"]
# 2