Skip to content

planetis-m/jsmn.nim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]

About

Jsmn - a world fastest JSON parser - in pure Nim

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Nim 100.0%