MCPcopy Create free account
hub / github.com/Var3D/var3dframe / get

Method get

core/src/core/java/var3d/net/center/json/VJSON.java:56–71  ·  view source on GitHub ↗

获取json路径下的某个元素(如果路径不存在返回null值) @param jsonPath 例如"rpg/man/hp",rpg和man为jsonObject @return

(String jsonPath)

Source from the content-addressed store, hash-verified

54 * @return
55 */
56 public Object get(String jsonPath) {
57 jsonPath = jsonPath.replaceAll("\\.", "/");
58 String[] paths = jsonPath.split("/");
59 Object o = null;
60 JSONObject object = jsonObj;
61 try {
62 for (String name : paths) {
63 o = object.get(name);
64 if (o instanceof JSONObject)
65 object = (JSONObject) o;
66 }
67 } catch (JSONException e) {
68 e.printStackTrace();
69 }
70 return o;
71 }
72
73 /**
74 * 获取json路径下的某个元素(如果路径不存在返回null值,并自动创建路径)

Callers 8

lengthMethod · 0.95
createMethod · 0.45
createForEmojiMethod · 0.45
upDataMethod · 0.45
getFontNameMethod · 0.45
getFontPropertieMethod · 0.45
peekMethod · 0.45
getFieldValueMethod · 0.45

Calls 1

getMethod · 0.95

Tested by

no test coverage detected