All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.larksuite.oapi.core.utils.Jsons Maven / Gradle / Ivy

Go to download

Larksuite open platform facilitates the integration of enterprise applications and larksuite, making collaboration and management more efficient

There is a newer version: 1.0.18-rc8
Show newest version
package com.larksuite.oapi.core.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.LongSerializationPolicy;

public class Jsons {

    public static final Gson LONG_TO_STR_GSON = createGSON(false, true);
    public static final Gson DEFAULT_GSON = createGSON(false, false);

    public static Gson createGSON(boolean isPretty, boolean longToStr) {
        GsonBuilder gsonBuilder = new GsonBuilder();
        if (longToStr) {
            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
        }
        if (isPretty) {
            gsonBuilder.setPrettyPrinting();
        }
        return gsonBuilder.create();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy