re.mko.jsnprsr:root

A Lean JSON Parser

License

License

GroupId

GroupId

re.mko.jsnprsr
ArtifactId

ArtifactId

root
Last Version

Last Version

0.1
Release Date

Release Date

Type

Type

pom
Description

Description

re.mko.jsnprsr:root
A Lean JSON Parser
Project URL

Project URL

http://el-tramo.be/jsnprsr
Source Code Management

Source Code Management

https://github.com/remko/jsnprsr

Download root

Filename Size
root-0.1.pom 3 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/re.mko.jsnprsr/root/ -->
<dependency>
    <groupId>re.mko.jsnprsr</groupId>
    <artifactId>root</artifactId>
    <version>0.1</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/re.mko.jsnprsr/root/
implementation 're.mko.jsnprsr:root:0.1'
// https://jarcasting.com/artifacts/re.mko.jsnprsr/root/
implementation ("re.mko.jsnprsr:root:0.1")
're.mko.jsnprsr:root:pom:0.1'
<dependency org="re.mko.jsnprsr" name="root" rev="0.1">
  <artifact name="root" type="pom" />
</dependency>
@Grapes(
@Grab(group='re.mko.jsnprsr', module='root', version='0.1')
)
libraryDependencies += "re.mko.jsnprsr" % "root" % "0.1"
[re.mko.jsnprsr/root "0.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • jsnprsr
  • jsnprsr-speedtests

JsnPrsr: A Lean JSON Parser

About

JsnPrsr is a fast, small, and lightweight JSON parser (and serializer), written in Java, with no external dependencies.

Usage

The entry point of the JsnPrsr library is the JSON class, which can be used to both parse and serialize JSON Values:

Value value = JSON.parse("{\"foo\": \"bar\", \"baz\": [4, 5]}");

System.out.println(value.getType());
System.out.println(value.getObject().get("foo").getString());
System.out.println(value.getObject().get("baz").getArray().get(0).getNumber());

value.getObject().put("foo", Value.array(Value.string("a"), Value.string("b")));

System.out.println(JSON.serialize(value));

Modification tips

  • If you want to track line numbers, edit Parser.java and comment out the lines referencing lineNumber.

  • If you want to support trailing commas in arrays, see the comment in Parser.readArray() and Parser.readObject(). This makes it support a more human writable form of JSON, accepting for example:

      {
        "foo": 1,
        "bar": 2,
      }
    

    and

      [
        "foo",
        "bar",
      ]
    

Versions

Version
0.1