(JsonElement element)
| 78 | } |
| 79 | |
| 80 | public static JsonObject safeObject(JsonElement element) { |
| 81 | try { |
| 82 | if (element.isJsonPrimitive()) element = parse(element.getAsJsonPrimitive().getAsString()); |
| 83 | return element.getAsJsonObject(); |
| 84 | } catch (Exception e) { |
| 85 | return new JsonObject(); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | public static Map<String, String> toMap(String json) { |
| 90 | return TextUtils.isEmpty(json) ? null : toMap(parse(json)); |