package com.pukka.jiecheng.utils; // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) // import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import java.util.Iterator; import java.util.Set; import org.json.JSONException; public class DataValueUtils { private static final String TAG = "DataValueUtils"; public DataValueUtils() { } public static String getDataValues(String dataAll, String... valueKeys) { String value = dataAll; try { for(int i = 0; i < valueKeys.length; ++i) { JSONObject jsonObject = JSON.parseObject(value); value = jsonObject.getString(valueKeys[i]); if (i == valueKeys.length - 1) { return value; } } } catch (Exception var5) { } return ""; } public static String setDataValue(String dataAll, String keys, String values) { try { JSONObject json = null; json = JSONObject.parseObject(dataAll); Set keySet = json.keySet(); Iterator var5 = keySet.iterator(); while(true) { while(var5.hasNext()) { String key = (String)var5.next(); Object obj = json.get(key); if (obj instanceof JSONArray) { JSONArray arr = (JSONArray)obj; for(int i = 0; i < arr.size(); ++i) { String child = setDataValue(arr.get(i).toString(), keys, values); arr.set(i, JSONObject.parse(child)); } json.put(key, arr); } else if (obj instanceof JSONObject) { JSONObject sub = (JSONObject)obj; String substr = setDataValue(sub.toJSONString(), keys, values); json.put(key, JSONObject.parse(substr)); } else if (key.equals(keys)) { json.put(key, values); } } return json.toJSONString(); } } catch (Exception var11) { return ""; } } public static org.json.JSONObject toJSONObject(String dataAll) { org.json.JSONObject jsonObject = new org.json.JSONObject(); try { JSONObject json = null; json = JSONObject.parseObject(dataAll); Set keySet = json.keySet(); Iterator var4 = keySet.iterator(); while(var4.hasNext()) { String key = (String)var4.next(); Object obj = json.get(key); jsonObject.put(key, obj); } return jsonObject; } catch (JSONException var7) { var7.printStackTrace(); return jsonObject; } } }