A simple java JSON deserializer that can convert a JSON into a java object in an easy way

Related tags

JSON Jsavon
Overview

JSavON

A simple java JSON deserializer that can convert a JSON into a java object in an easy way.
This library also provide a strong object convertion.

Deserializing JSONObject

We have this JSONObject :

{
  "orderListId": 29,
  "contingencyType": "OCO",
  "listClientOrderId": "amEEAXryFzFwYF1FeRpUoZ",
  "transactionTime": 1565245913483,
  "symbol": "LTCBTC",
  "orders": [
    {
      "symbol": "LTCBTC",
      "orderId": 4,
      "clientOrderId": "oD7aesZqjEGlZrbtRpy5zB"
    },
    {
      "symbol": "LTCBTC",
      "orderId": 5,
      "clientOrderId": "Jr1h6xirOxgeJOUuYQS7V3"
    }
  ],
  "data" : {
    "total":20
  }
},

The corresponding java object will be :

orders; //Constructor public MyObject(JSONObject json) { super(json); this.time = System.currentTimeMillis(); } //Getters and Setters ... }">
public class MyObject extends JSavONObject {

  //The JSavON code will search in the json the corresponding key (the field name)
  //By default, the key will be the field name
  private int orderListId;
  private long transactionTime;
  //But you can change the key using
  @JOValue(keys = "contingencyType") private MyEnum ct;
  //You can also use multiple keys
  @JOValue(keys = {"listClientOrderId", "listCOI"}) private String listClientOrderId;
  
  //You can set manual value using the annotation ManualValue
  @ManualValue private long time;
  
  //You can also use a path for retrieving value
  @JOValue(paths = {"data"}) private int total;
  
  //Indicate that this field is not mandatory (default=true) 
  @JOValue(mandatory = false) private String symbol;
  
  
  @MapKey(fieldName = "symbol") private Map<String, Order> orders;
  
  //Constructor
  public MyObject(JSONObject json) {
    super(json);
    this.time = System.currentTimeMillis();
  }
  
  //Getters and Setters
  ...
}

Information

This library is mainly used in JBinanceAPI but you can use it for any other project
There are a lot more you can do with this library, like customizing retrieving algorithm, parsing JSONArray...

Donation

I'm a student, so any help will be appreciated

For gentleman

BTC : 1JJZrkZEynrCqoPrJWKbtGLSyJziDmKKka

For optimistics

ETH : 0xe349abf167a8d265785b256666737ecd5720d4bd

BNB Love

BNB : bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23
TAG : 107019672

Some XRP ?

XRP : rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh
TAG : 109836101

Maybe you prefer ADA ?

ADA : DdzFFzCqrht7QmsyECRJsZiM3neGxrGFjhrkDHjCnjT1w45oeVeNKf1KwBQWcVcPCcAuz7kfzbMhTG8BEpgX7FRy25XdTsk4RfM6YXqC

You might also like...

An expressive Mock Object library for Test Driven Development

JMock Library Maven dependency groupIdorg.jmock/groupId artifactIdjmock-junit5/artifactId version2.12.0/version scope

Aug 23, 2022

A toy compiler that translates SysY (a subset of C language) into ARMv7a, implemented in Java15.

A toy compiler that translates SysY (a subset of C language) into ARMv7a, implemented in Java15.

北京航空航天大学 No Segmentation Fault Work 队作品。 ayame A toy compiler that translates SysY (a subset of C language) into ARMv7a. Build javac -encoding UTF-8 $

Jan 2, 2023

A modern JSON library for Kotlin and Java.

Moshi Moshi is a modern JSON library for Android and Java. It makes it easy to parse JSON into Java objects: String json = ...; Moshi moshi = new Mos

Dec 31, 2022

A fast JSON parser/generator for Java.

A fast JSON parser/generator for Java.

fastjson Fastjson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON str

Dec 31, 2022

Sawmill is a JSON transformation Java library

Sawmill is a JSON transformation Java library

Update: June 25, 2020 The 2.0 release of Sawmill introduces a breaking change to the GeoIpProcessor to comply with the updated license of the MaxMind

Jan 1, 2023

Genson a fast & modular Java Json library

Genson Genson is a complete json - java conversion library, providing full databinding, streaming and much more. Gensons main strengths? Easy to use

Jan 3, 2023

A reference implementation of a JSON package in Java.

JSON in Java [package org.json] Click here if you just want the latest release jar file. Overview JSON is a light-weight language-independent data int

Jan 6, 2023

Fast JSON parser for java projects

ig-json-parser Fast JSON parser for java projects. Getting started The easiest way to get started is to look at maven-example. For more comprehensive

Dec 26, 2022

A JSON Schema validation implementation in pure Java, which aims for correctness and performance, in that order

Read me first The current version of this project is licensed under both LGPLv3 (or later) and ASL 2.0. The old version (2.0.x) was licensed under LGP

Jan 4, 2023
Owner
null
MapNeat is a JVM library written in Kotlin that provides an easy to use DSL (Domain Specific Language) for transforming JSON to JSON, XML to JSON, POJO to JSON in a declarative way.

MapNeat is a JVM library written in Kotlin that provides an easy to use DSL (Domain Specific Language) for transforming JSON to JSON, XML to JSON, POJ

Andrei Ciobanu 59 Sep 17, 2022
A 250 lines single-source-file hackable JSON deserializer for the JVM. Reinventing the JSON wheel.

JSON Wheel Have you ever written scripts in Java 11+ and needed to operate on some JSON string? Have you ever needed to extract just that one deeply-n

Roman Böhm 14 Jan 4, 2023
A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back, with a transparent support of any kind of self-references and with a full Java 9 compatibility.

Andrey Mogilev 9 Dec 30, 2021
A Java serialization/deserialization library to convert Java Objects into JSON and back

Gson Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to a

Google 21.7k Jan 8, 2023
Text Object Java Objects (TOJOs): an object representation of a multi-line structured text file like CSV

It's a simple manager of "records" in a text file of CSV, JSON, etc. format. It's something you would use when you don't want to run a full database,

Yegor Bugayenko 19 Dec 27, 2022
JSON to JSON transformation library written in Java.

Jolt JSON to JSON transformation library written in Java where the "specification" for the transform is itself a JSON document. Useful For Transformin

Bazaarvoice 1.3k Dec 30, 2022
Generate Java types from JSON or JSON Schema and annotates those types for data-binding with Jackson, Gson, etc

jsonschema2pojo jsonschema2pojo generates Java types from JSON Schema (or example JSON) and can annotate those types for data-binding with Jackson 2.x

Joe Littlejohn 5.9k Jan 5, 2023
Essential-json - JSON without fuss

Essential JSON Essential JSON Rationale Description Usage Inclusion in your project Parsing JSON Rendering JSON Building JSON Converting to JSON Refer

Claude Brisson 1 Nov 9, 2021
A simple java json configuration system built with gson.

Simple Configuration A simple json configuration system built with gson. Setup ?? Using Maven REPOSITORY <repositories> <repository> <id>j

Kacper Horbacz 2 Sep 24, 2022
dOOv (Domain Object Oriented Validation) a fluent API for type-safe bean validation and mapping

dOOv (Domain Object Oriented Validation) dOOv is a fluent API for typesafe domain model validation and mapping. It uses annotations, code generation a

dOOv 77 Nov 20, 2022