JSON

A very lite and powerful JSON parser/serializer Java implementation.

License

License

Categories

Categories

JSON Data
GroupId

GroupId

tech.sobin
ArtifactId

ArtifactId

json
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

JSON
A very lite and powerful JSON parser/serializer Java implementation.
Project URL

Project URL

https://github.com/carbon-lab/JSON
Source Code Management

Source Code Management

https://github.com/carbon-lab/JSON/tree/master

Download json

How to add to project

<!-- https://jarcasting.com/artifacts/tech.sobin/json/ -->
<dependency>
    <groupId>tech.sobin</groupId>
    <artifactId>json</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/tech.sobin/json/
implementation 'tech.sobin:json:1.2.0'
// https://jarcasting.com/artifacts/tech.sobin/json/
implementation ("tech.sobin:json:1.2.0")
'tech.sobin:json:jar:1.2.0'
<dependency org="tech.sobin" name="json" rev="1.2.0">
  <artifact name="json" type="jar" />
</dependency>
@Grapes(
@Grab(group='tech.sobin', module='json', version='1.2.0')
)
libraryDependencies += "tech.sobin" % "json" % "1.2.0"
[tech.sobin/json "1.2.0"]

Dependencies

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

Project Modules

There are no modules declared in this project.

JSON

A very lite and powerful JSON parser/serializer implementation.

Get start

It's easy.

If you want to parse JSON string in java, use: JSON.parse(json).

Similarly, if you want to convert a JSObject instance to a JSON string, just JSON.stringify(object)

Classes

Here talk about the classes.

Firstly, all the classes you might use in this project is named start with 'JS'. And all of them are the sub-class of JSBase directly or indirectly.

The JSObject is similar to the Java standard class Map<String, JSBase> which use a string object to map other JSON object. But it is NOT a sub-class of Map.

The JSArray is used to hold the data of the array in JSON. It is similar to Map<Integer, JSBase>.

Other class is stand for the base type of JSON like number, string, etc.

JSON

This is a programming interface class. It only contains two functions: parse and stringify.

The parse function is used to parse a JSON string and returns a JSObject object which could also be a JSArray object.

public static JSObject parse(String json)

stringify functions will returns the JSON string of any JSObject instance.

public static String stringify(JSObject object)

JSObject

// Set a field in JSON object
public JSBase put(String key, JSBase value)

// Get a field from JSON object
public JSBase get(String key)

// Get the key-value entry set
public Set<Entry<String, JSBase>> entrySet()

JSArray

// Set s value in the array by number index
public void set(int index, JSBase value)

// Get a value in the array by number index
public JSBase get(int index)

// Get the amount of elements
public int length()

// Append an element to the array end, like push() in JavaScript
public void push(JSBase value)

Versions

Version
1.2.0
1.1.0
1.0.0