package com.navinfo.outdoor.util;

import org.json.JSONException;
import org.json.JSONObject;

//去掉空的字符
public class Whetherisempty {
    public static String getClfz(String s) throws JSONException {
        JSONObject jsonObject = new JSONObject(s);
        if (!jsonObject.has("body") || String.valueOf(jsonObject.get("body")).equals("[]") || String.valueOf(jsonObject.get("body")).equals("")) {
            jsonObject.put("body", null);
            return jsonObject.toString();
        } else {
            return s;
        }
    }

    public static String getCl(String s) {
        String s2 = s.substring(s.length() - 3, s.length() - 1);
        if (s2.equals("[]") || s2.equals("")) {
            return s.substring(0, s.lastIndexOf(",")) + "}";
        } else {
            return s;
        }
    }
}
