net.cadrian.jsonref:jsonref

JSON/R is an extended JSON format that natively supports object references, thus allowing to de/serialize object graphs, even with cycles.

License

License

MIT
Categories

Categories

Net JSON Data
GroupId

GroupId

net.cadrian.jsonref
ArtifactId

ArtifactId

jsonref
Last Version

Last Version

0.0.11
Release Date

Release Date

Type

Type

pom
Description

Description

net.cadrian.jsonref:jsonref
JSON/R is an extended JSON format that natively supports object references, thus allowing to de/serialize object graphs, even with cycles.
Project URL

Project URL

https://github.com/cadrian/jsonref
Source Code Management

Source Code Management

https://github.com/cadrian/jsonref

Download jsonref

Filename Size
jsonref-0.0.11.pom 4 KB
Browse

How to add to project

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

Dependencies

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

Project Modules

  • jsonref-core

Build Status

See http://cadrature.blogspot.fr/2015/06/jsonr.html

Why a new JSON parser?

JSON is well and good, but it has one shortcoming: the management of object references. When you have to serialize an object graph, with object cycles, JSON is lost.

I needed to serialize such a graph. So I wrote a JSON extension, dubbed "JSON/R" (JSON with references).

I wanted the parser to stay as pretty as the standard JSON's (see a previous article), with the same property: a parser with no backtrack.

I added two concepts: "heap" and "reference".

A "heap" is just an array with different brackets (< and >); its usage is that the objects in it are referenced by their position in the array. By convention, the root object of the graph (i.e. the one the serialization started from) is the first one, noted $0 (see below).

A "reference" is an index into the heap: noted $<integer>.

An example

<{"class":"net.cadrian.jsonref.Pojo","reference":$1,"timestamp":"3915-07-10T12:00:00.000","value":"a"},{"class":"net.cadrian.jsonref.Pojo","reference":$0,"timestamp":null,"value":"b"}>

The class is a simple pojo with a String value, a Date timestamp, and another Pojo reference. The example above shows two objects referencing each other.

Versions

Version
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4