package com.ifpdos.Utils;

import com.google.gson.Gson;

/* JADX INFO: loaded from: classes.dex */
public class JsonUtils {
    private static final Gson gson = new Gson();

    public static String toJson(Object obj) {
        try {
            return gson.toJson(obj);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static <T> T fromJson(String str, Class<T> cls) {
        try {
            return (T) gson.fromJson(str, (Class) cls);
        } catch (Exception unused) {
            return null;
        }
    }
}
