Skip to content
/ yoru Public

A simple library to create pojos of any type from json and convert any type of pojo to json

Notifications You must be signed in to change notification settings

nextbss/yoru

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yoru (夜)

A simple Java Util wrapper over jackson-binding for converting json to any object type and vice-versa.

Usage

Convert to Json

Use the toJson(T) method to convert any object of type T to JSON.

 Coordinates coordinates = new Coordinates(10, 20, 30);
 Yoru<Coordinates> converter = new Yoru<>();
 converter.toJson(coordinates);

Result:

{
  "x" : 10.0,
  "y" : 20.0,
  "z" : 30.0
}

Convert from Json

Use the fromJson(String content) method to convert json to any type T.

 Yoru<Coordinates> converter = new Yoru<>();
 Coordinates coordinates = converter.fromJson(toJsonExpectation, Coordinates.class);

Download

This library can be used with both maven and gradle build environments. See instructions below for more details on how to add this to your project.

Step 1. Add the JitPack repository to your build file

maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

gradle

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency

maven

<dependency>
        <groupId>com.github.nextbss</groupId>
        <artifactId>yoru</artifactId>
        <version>1.0.2</version>
</dependency>

gradle

dependencies {
    implementation 'com.github.nextbss:yoru:1.0.2'
}

License

The library is available as open source under the terms of the MIT License.

About

A simple library to create pojos of any type from json and convert any type of pojo to json

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages