Code Monkey home page Code Monkey logo

jsmn.nim's Introduction

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]

jsmn.nim's People

Contributors

ba0f3 avatar planetis-m avatar sinkingsugar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jsmn.nim's Issues

Is this actually the world's fastest JSON parser?

Hello there, I've recently been looking at @OpenSystemLab's projects and couldn't help but wonder if the claim of being the fastest JSON parser in the world is a made up claim or not. Are there any benchmarks to back up the claims? I'm sorry if I sound offending or rude, I'm just curious.

Usage example doesn't compile

Error: type mismatch: got <string, array[0..31, JsmnToken]>
but expected one of:
proc parseJson(json: string; initialSize = JSMN_TOKENS; autoResize = false): seq[
JsmnToken]
first type mismatch at position: 2
required type for initialSize: int
but expression 'tokens' is of type: array[0..31, JsmnToken]
proc parseJson(json: string; tokens: var seq[JsmnToken]; autoResize = false): int
first type mismatch at position: 2
required type for tokens: var seq[JsmnToken]
but expression 'tokens' is of type: array[0..31, JsmnToken]

expression: parseJson(json, tokens)

Accept memory maps and streams

Memory maps for large JSON files would be nice to have, as well as support for some sort of streaming mechanism (for things like sockets).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.