Extract considerate value from json arg for compute cache key and function of key<br>
Example : if key = "a.i" and jsonarg = {\"i\":5} then return 5

@param path
@param jsonArg
@return
339184
String processArg(String[] path, String jsonArg) {
		String keyArg = jsonArg;
		if (path.length > 0) {
			try {
				keyArg = processSubFieldsOfArg(path, jsonArg);
			} catch (Throwable ex) {
				logger.warn("Fail to access to field for '{}'", jsonArg, ex);
			}
		}
		return keyArg;
	}
26873
function applyPath(path, jsonBody, isNot) {
  // TODO input validation
  // * path cannot end in '.'
  // * path cannot be ''
  // * path cannot have more than one '*'/'?'
  // * path cannot start with ? or * and have more stuff after

  // states the last option in the path
  let lastOption

  // split up the path by '.'
  const pathSegments = path.split('.')
  // temporarially store the last option
  const tmpLast = pathSegments[pathSegments.length - 1]
  // if the last option is not a '*' or '?', set it to unefined as the developer didn't specify one
  if ('*' === tmpLast || '?' === tmpLast) {
    lastOption = tmpLast
  }

  try {
    // break apart the path and iterate through the keys to traverse through the JSON object
    pathSegments.forEach(segment => {
      // if the next 'segment' isn't actually a special character, traverse through the object
      if ('*' !== segment && '?' !== segment) {
        jsonBody = jsonBody[segment]
      }
    })
  } catch (e) {
    if (!isNot) {
      throw e
    } else {
      console.warn(
        "[IcedFrisby] You attempted to traverse through an object with a path ('" +
          path +
          "') that did not exist in the object. \
This issue was suppressed because you specified the isNot option. This behavior is usually considered an anti-pattern. Use a schema check instead."
      )
    }
  }

  return { lastOption, jsonBody }
}
973070
public static Object getByPath(Object target, List<String> path) {
        Object obj = target;

        for (String field : path) {
            if (obj == null) {
                return null;
            }
            obj = evaluate(obj, trimType(field));
        }

        return obj;
    }
8917
public JSONObject getPathFromEndpoint(String pathValue, String requestType) throws Exception {
        int type = getRequestTypeFromString(requestType);
        String url = BASE_PATH;
        JSONObject response = new JSONObject(doGet(url, null));
        JSONArray paths = response.getJSONArray("paths");
        for (int i = 0; i < paths.length(); i++) {
            JSONObject path = paths.getJSONObject(i);
            if (path.getString("path").equals(pathValue) && path.getInt("requestType") == type) {
                return path;
            }
        }
        return null;
    }
1053052
@GET
    @Path("{key}")
    public Response getMBean(@PathParam("key") String key,
                             @QueryParam("jsonp") @DefaultValue("") String jsonp)
            throws Exception {
        LOG.info("key: " + key);

        JSONObject json = new JSONObject();

        ObjectName name = new ObjectName(key);
        json.put("domain", name.getDomain());
        json.put("property", name.getKeyPropertyList());

        if (key.contains("*")) {
            JSONObject keys = new JSONObject();
            for (Entry<String, Map<String, String>> attrs : jmx
                    .getMBeanAttributesByRegex(key).entrySet()) {
                keys.put(attrs.getKey(), attrs.getValue());
            }
            json.put("attributes", keys);
            json.put("multikey", true);
        } else {
            json.put("attributes", jmx.getMBeanAttributes(key));
            json.put("multikey", false);

            MBeanOperationInfo[] operations = jmx.getMBeanOperations(key);
            JSONArray ar = new JSONArray();
            for (MBeanOperationInfo operation : operations) {
                JSONObject obj = new JSONObject();
                obj.put("name", operation.getName());
                obj.put("description", operation.getDescription());
                obj.put("returnType", operation.getReturnType());
                obj.put("impact", operation.getImpact());

                JSONArray params = new JSONArray();
                for (MBeanParameterInfo param : operation.getSignature()) {
                    JSONObject p = new JSONObject();
                    p.put("name", param.getName());
                    p.put("type", param.getType());
                    params.put(p);
                }
                obj.put("params", params);
                ar.put(obj);
            }
            json.put("operations", ar);
        }

        StringWriter out = new StringWriter();
        if (jsonp.isEmpty()) {
            json.write(out);
        } else {
            out.append(jsonp).append("(");
            json.write(out);
            out.append(");");
        }
        return Response.ok(out.toString()).type(MediaType.APPLICATION_JSON)
                .build();
    }
1334380
@Deprecated
    public static boolean nodeExists(Object json, String path) {
        return !getNode(json, path).isMissingNode();
    }
871795
function valueFromPath(o, path = []) {
  return path.reduce((ret, seg) => isObject(ret) && ret[seg], o);
}
195735
public JSONObject getJsonConfig(Path name)
      throws IOException, JSONException {
    String pathString = name.toUri().getPath();
    String xml = new Path(pathString).getName();
    File jsonFile = new File(pathString.replace(xml, MATERIALIZEDJSON))
        .getAbsoluteFile();
    if (jsonFile.exists()) {
      InputStream in = new BufferedInputStream(new FileInputStream(jsonFile));
      if (in != null) {
        JSONObject json = instantiateJsonObject(in);
        // Try to load the xml entity inside the json blob.
        if (json.has(xmlToThrift(xml))) {
          return json.getJSONObject(xmlToThrift(xml));
        }
      }
    }
    return null;
  }
1070536
public AbstractBooleanAssert<?> jsonPathAsBoolean(String path) {
        return Assertions.assertThat(actual.read(path, Boolean.class));
    }
985966
@ResponseOverride(
            description = "Set a JSON value.",
            parameters = {"name", "value", "path"}
    )
    public static void set_json_value(PluginArguments args, String name, String value, String path) throws Exception {
        HttpServletResponse response = args.getResponse();
        String content = PluginHelper.readResponseContent(response);
        JSONObject jsonContent = new JSONObject(content);

        process_json_value(jsonContent, name, value, path, true);
        PluginHelper.writeResponseContent(response, jsonContent.toString());
    }
951615
public static JsonNode getValue(JsonNode node, String dPath) {
        return DPathUtils.getValue(node, dPath);
    }
983630
def get_value_from_path(self, keypath):
        
        if isinstance(keypath, list):
            if len(keypath) == 0:
                # empty list is root
                return 
            val = self 
            for next_key in keypath:
                val = val[next_key]
            return val
        else:
            return self.__dict__['p'][keypath]
290789
@Deprecated
    public String get(String path) {
        final JsonValue value = this.values.get(this.pathToProperty(path));
        if (value == null) {
            return null;
        }
        if (!value.isString()) {
            return value.toString();
        }
        return value.asString();
    }
1106955
@Override
    @Path("/{valueName}/{value}")
    public JSONObject get(String path, Map<String, String> headers)
            throws ServiceException, JSONException {
        Map<String, String> parameters = getParameters(headers);
        String valueName = getSegment(path, 1);
        if (valueName == null)
            throw new ServiceException("Missing path segment: {valueName}");
        String valuePattern = getSegment(path, 2);
        String ownerType = parameters.get("holderType");

        try {
            if (valuePattern == null)
                return getValues(valueName, ownerType).getJson();
            else
                return getValues(valueName, valuePattern, ownerType).getJson();
        }
        catch (Exception ex) {
            throw new ServiceException("Error loading value holders for " + valueName, ex);
        }
    }
802511
CacheResourceCore getCore(String path, String name) {
	Object obj = getCache().getValue(toKey(path, name), null);
	if (obj instanceof CacheResourceCore) return (CacheResourceCore) obj;
	return null;
    }
574204
public static Object evaluate(Object jsonPathResult, String jsonPathFunction) {
        switch (jsonPathFunction) {
            case "exists":
                return jsonPathResult != null;
            case "size":
                if (jsonPathResult instanceof JSONArray) {
                    return ((JSONArray) jsonPathResult).size();
                } else if (jsonPathResult instanceof JSONObject) {
                    return ((JSONObject) jsonPathResult).size();
                } else {
                    return jsonPathResult != null ? 1 : 0;
                }
            case "keySet":
                if (jsonPathResult instanceof JSONObject) {
                    return ((JSONObject) jsonPathResult).keySet();
                } else {
                    return Collections.emptySet();
                }
            case "values":
                if (jsonPathResult instanceof JSONObject) {
                    Object[] valueObjects = ((JSONObject) jsonPathResult).values().toArray();
                    List<String> values = new ArrayList<>(valueObjects.length);
                    for (Object value : valueObjects) {
                        if (value instanceof JSONObject) {
                            values.add(((JSONObject) value).toJSONString());
                        } else if (value instanceof JSONArray) {
                            values.add(((JSONArray) value).toJSONString());
                        } else {
                            values.add(String.valueOf(value));
                        }
                    }

                    return values.toString();
                } else {
                    return new Object[]{};
                }
            case "toString":
                if (jsonPathResult instanceof JSONArray) {
                    return ((JSONArray) jsonPathResult).toJSONString();
                } else if (jsonPathResult instanceof JSONObject) {
                    return ((JSONObject) jsonPathResult).toJSONString();
                } else {
                    return jsonPathResult.toString();
                }
        }

        return jsonPathResult;
    }
24706
def value_for_keypath(obj, path):
    
    val = obj
    for part in path.split('.'):
        match = re.match(list_index_re, part)
        if match is not None:
            val = _extract(val, match.group(1))
            if not isinstance(val, list) and not isinstance(val, tuple):
                raise TypeError('expected list/tuple')
            index = int(match.group(2))
            val = val[index]
        else:
            val = _extract(val, part)
        if val is None:
            return None
    return val