mirror of
https://github.com/OpenSystemsLab/jsmn.nim
synced 2026-01-14 15:51:39 +00:00
No description
| .github | ||
| tests | ||
| .gitignore | ||
| jsmn.nim | ||
| jsmn.nimble | ||
| LICENSE | ||
| README.md | ||
jsmn.nim
Jsmn - a world fastest JSON parser - in pure Nim
According to this benchmark script with about 3MB JSON of World Bank dataset, JSMN is 2-2.5 times faster than marshal

Usage
import jsmn
const
json = """{
"user": "johndoe",
"admin": false,
"uid": 1000,
"groups": ["users", "wheel", "audio", "video"]}"""
var tokens = newSeq[JsmnToken](32) # expect not more than 32 tokens
let r = parseJson(json, tokens)
for i in 1..r:
var token = addr tokens[i]
echo "Kind: ", token.kind
echo "Value: ", json[token.start..<token.stop]
