This project deprecated, use instead opack
This project is a library developed by REALTIMETECH Solution Division 2.
Kson is a new data format compatible with the Json standards. It solves the ambiguous number type problem of Json and supports the following data types.
{
"longValueLower" : 100l,
"floatValueLower" : 100.2f,
"doubleValueLower" : 100.2d,
"longValueUpper" : 100L,
"floatValueUpper" : 100.2F,
"doubleValueUpper" : 100.2D,
"automaticInteger" : 20,
"automaticDecimal" : 10.1
{
"A": "B"
} : "Now, you can use object like a key!",
["A", "B"] : "And, array!"
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.realtimetech-solution:kson:[Version]'
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.realtimetech-solution</groupId>
<artifactId>kson</artifactId>
<version>[Version]</version>
</dependency>
Please refer to the releases part of this repository.
All Parse, Serialize, Deserialize are available through KsonContext by default.
KsonBuilder ksonBuilder = new KsonBuilder();
KsonContext ksonContext = ksonBuilder.build();
KsonContext ksonContext = new KsonContext();
KsonBuilder ksonBuilder = new KsonBuilder();
KsonPool ksonPool = new KsonPool(ksonBuilder);
KsonContext ksonContext = ksonPool.get();
Kson supports Serialize and Deserialize for String, Object, and JsonValue.
KsonContext ksonContext = new KsonContext();
String jsonString = "{...}";
JsonValue jsonValue = ksonContext.fromString(jsonString);
JsonValue jsonValue = ...;
String jsonString = jsonValue.toJsonString(); //Usage of standard Json format.
String ksonString = jsonValue.toKsonString(); //Usage of extended Kson format.
KsonContext ksonContext = new KsonContext();
Person personObject = someObject;
JsonValue jsonValue = ksonContext.fromObject(personObject);
KsonContext ksonContext = new KsonContext();
JsonValue jsonValue = ...;
Person personObject = ksonContext.toObject(Person.class, jsonValue);
KsonContext ksonContext = new KsonContext();
String jsonString = "{...}";
Person personObject = ksonContext.toObject(Person.class, jsonString);
Kson supports useful functions through Annotation.
public class Person {
private int id;
private String name;
@Ignore
private byte[] tempArray;
}
Now, 'tempArray' field is not serialized.
public class Person {
@PrimaryKey
private int id;
private String name;
}
Now, this class's instance is serialize by 'id' field instead.
Kson uses Apache License 2.0. Please, leave your feedback if you have any suggestions!
JeongHwan, Park
+821032735003
[email protected]