No description
Find a file
2021-10-01 08:02:20 +07:00
.github Create FUNDING.yml 2021-10-01 08:02:20 +07:00
tests Uncomment tests that now pass 2021-05-09 14:51:37 +03:00
.gitignore Initial commit 2016-02-22 14:05:13 +07:00
jsmn.nim Many tweaks and performance improvements 2019-05-11 10:27:17 +07:00
jsmn.nimble update screenshots 2019-05-11 10:42:11 +07:00
LICENSE Initial commit 2016-02-22 14:05:13 +07:00
README.md Fix example in README, refs #7 2021-04-08 15:05:47 +07:00

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 Benchmark result

Benchmark result

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]