package com.bxzk.afxj.util;


import androidx.collection.ArrayMap;

import com.google.gson.Gson;

import java.util.Map;

/**
 * Created by 「孙晨」 on 2018/3/23 0023   14:23.
 * <p>
 * God bless me only
 * <p>
 * Model2JsonTool
 */


public class Model2JsonTool {

    public static <T> Map<String, String> Model2Json(T t) {
        Map<String, String> stringStringMap = new ArrayMap<>();
        String paramJson = new Gson().toJson(t);
        stringStringMap.put("json", paramJson);
        return stringStringMap;
    }


//    String paramLoginStr = new Gson().toJson(qualityCheckRequest)
//            .replace("\\", "")
//            .replace("\"{", "{")
//            .replace("}\"", "}");

    public static <T> String Model2String(T t) {
        String paramLoginStr = new Gson().toJson(t)
                .replace("\\", "")
                .replace("\"{", "{")
                .replace("}\"", "}");

        return paramLoginStr;
    }
}
