/** * Created by ldp. * <p> * Date: 2021-02-07 * <p> * Summary: json 数据格式化显示 */ public class JsonFormatUtil { /** * json 数据格式化输出 * @param response * @return */ public static String formatDataFromJson(String response) { try { if (response.startsWith("{")) { JSONObject jsonObject = new JSONObject(response); return jsonObject.toString(4); } else if (response.startsWith("[")) { JSONArray jsonArray = new JSONArray(response); return jsonArray.toString(4); } } catch (Exception e) { e.printStackTrace(); } return response; } }
安卓 json数据简易 格式化打印日志 Logcat
最新推荐文章于 2021-05-26 21:06:05 发布