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

com.cyberark.conjur.util.JsonSupport Maven / Gradle / Ivy

package com.cyberark.conjur.util;


import com.google.gson.Gson;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

/**
 *
 */
public class JsonSupport {
    public static String toJson(Object object){
       return new Gson().toJson(object);
    }

    public static  T fromJson(String json, Class type){
        return new Gson().fromJson(json, type);
    }

    public static  T fromJson(Reader json, Class type){
        return new Gson().fromJson(json, type);
    }


    public static  T fromJson(InputStream json, Class type){
        final Reader reader = new BufferedReader(new InputStreamReader(json));
        return fromJson(reader, type);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy