package com.cool.store.utils;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.util.Map;

/**
 * @Author suzhuhong
 * @Date 2025/3/26 19:39
 * @Version 1.0
 */

public class JsonUtils {
    private static final Gson gson = new Gson();

    public static String toJson(Object obj) {
        return gson.toJson(obj);
    }

    public static Map<String, Object> parseJsonToMap(String json) {
        return gson.fromJson(json, new TypeToken<Map<String, Object>>() {}.getType());
    }
}
