Json Easy

Lightweight and simple json api write in pure java without any dependencies.

Лицензия

Лицензия

Категории

Категории

JSON Данные
Группа

Группа

fr.bigray
Идентификатор

Идентификатор

json-easy
Последняя версия

Последняя версия

1.1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Json Easy
Lightweight and simple json api write in pure java without any dependencies.
Ссылка на сайт

Ссылка на сайт

https://github.com/Big-Ray/json-easy
Система контроля версий

Система контроля версий

https://github.com/Big-Ray/json-easy/tree/master

Скачать json-easy

Как подключить последнюю версию

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

Зависимости

test (1)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-engine jar 5.2.0

Модули Проекта

Данный проект не имеет модулей.

Json-Easy

Build status: build_status Coverage status : codecov

Json-Easy has for vocation to be most simple to create, parse and manipulate Json with Java.

Json-Easy is written in pure Java without any others dependencies to be lightweight as possible.

Getting Started

Create a JsonObject

JsonObject jsObjectChild = JsonObject.createObject()
	.$( "key1", "value1" )
	.$( "key2", "value2" );

JsonObject jsObject = JsonObject.createObject()
    .$( "key1", "value1" )
    .$( "key2", "value2" )
    .$( "key3", 1 )
    .$( "key4", 123.45 )
    .$$( jsObjectChild )
    .$( "key5", JsonObject.createObject()
        .$( "key1", "value1" )
        .$( "key2", "value2" )
        .$( "key3", JsonArray.createArray()
            .$( "value1" )
            .$( "value2" )
            .$( 3 )
            .$( JsonObject.createObject()
                .$( "key1", "value1" )
            )
        ))
    ))
);

Create a JsonArray

JsonArray jsArrayChild = JsonArray.createArray()
	.$( "value1" )
	.$( 12345 )
	.$( 1L );

JsonArray jsArray = JsonArray.createArray()
    .$( "value1" )
    .$( "value2" )
    .$( 1 )
    .$( 123.45 )
    .$$( jsArrayChild )
    .$( JsonObject.createObject()
        .$( "key1", "value1" )
        .$( "key2", "value2" )
        .$( "key3", JsonArray.createArray()
            .$( "value1" )
            .$( "value2" )
            .$( 3 )
            .$( JsonObject.createObject()
                .$( "key1", "value1" )
            )
        ))
    ))
);

JsonValue to json string

JsonObject jsObject = JsonObject.createObject()
    .$( "key1", "value1" )
    .$( "key2", "value2" )
);
String json = JsObject.toJson();

// Ouput {"key1":"value1", "key2":"value2"}

JsonValue from json string

JsonValue jsValue = JsonParser.parse( "{\"key1\":\"value1\"}" );
JsonObject jsObject = jsonValue.as(JsonObject.class);

// Other way
JsonArray jsArray = JsonArray.fromJson( "[\"value1\", 1234]" );

JsonObject and JsonArray manipulation

JsonObject and JsonArray classes extends respectively LinkedHashMap<String, JsonValue> and ArrayList<JsonValue>, so, if you known how to manipule these Collections, you known to manipulate JsonObject and JsonArray.

License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.

Built With

  • Maven - Dependency Management

Author

  • Raynald BUQUET - Big-Ray

Версии библиотеки

Версия
1.1.1