com.i2soft.util.Json Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of i2up-java-sdk Show documentation
Show all versions of i2up-java-sdk Show documentation
Information2 United Data Management Platform SDK for Java
The newest version!
package com.i2soft.util;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.Map;
public final class Json {
private Json() {
}
public static String encode(StringMap map) {
return new Gson().toJson(map.map());
}
public static String encode(Object obj) {
return new GsonBuilder().serializeNulls().disableHtmlEscaping().create().toJson(obj);
}
public static T decode(String json, Class classOfT) {
return getIntGson().fromJson(json, classOfT);
}
public static StringMap decode(String json) {
// CHECKSTYLE:OFF
Type t = new TypeToken
© 2015 - 2024 Weber Informatics LLC | Privacy Policy