JSON Auto Serialize/deserialize

Auto serialization/deserialization classes for jsonutil

Лицензия

Лицензия

Категории

Категории

Сеть Auto Библиотеки уровня приложения Code Generators JSON Данные
Группа

Группа

net.pwall.json
Идентификатор

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

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

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

2.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

JSON Auto Serialize/deserialize
Auto serialization/deserialization classes for jsonutil
Ссылка на сайт

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

https://github.com/pwall567/jsonauto
Система контроля версий

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

https://github.com/pwall567/jsonauto.git

Скачать jsonauto

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

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

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
net.pwall.json : jsonutil jar 2.0
net.pwall.util : javautil jar 2.0

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11

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

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

jsonauto

JSON auto serialize / deserialize from / to Java.

Background

I am not a big fan of reflection-based automatic serialization and deserialization of Java objects to and from JSON - reflection is always slower than explicit serialization and it sometimes gives unexpected results. But I know that many people prefer it so I've added it as an optional additional package to my jsonutil library.

Usage

To serialize any object:

JSONValue json = JSONSerializer.serialize(object);
String text = json.toJSON();

Nested objects are handled automatically, as are many of the commonly-used classes from java.lang and java.util (more documentation to follow).

To deserialize:

JSONValue json = JSON.parse(text);
UserClass userObject = JSONDeserializer.deserialize(UserClass.class, json);

See the JavaDoc for more information.

Annotations

Annotations are available to specify that a field is to be ignored, or always included even if null (the default behaviour is to ignore null fields). The field name may also be specified.

  • @JSONIgnore - never serialize
  • @JSONAlways - always serialize
  • @JSONName("name") - use the specified name when serializing

Maven

The library is in the Maven Central Repository; the co-ordinates are:

<dependency>
  <groupId>net.pwall.util</groupId>
  <artifactId>jsonauto</artifactId>
  <version>1.0</version>
</dependency>

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

Версия
2.3
2.2
2.1
2.0