Walks through the Json object structure and translates values based on element path if necessary.
@param jsonData
@param jsonPath
@param context
429395
private void traverseJsonData(JSONObject jsonData, String jsonPath, TestContext context) {
        for (Iterator it = jsonData.entrySet().iterator(); it.hasNext();) {
            Map.Entry jsonEntry = (Map.Entry) it.next();

            if (jsonEntry.getValue() instanceof JSONObject) {
                traverseJsonData((JSONObject) jsonEntry.getValue(), (StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()), context);
            } else if (jsonEntry.getValue() instanceof JSONArray) {
                JSONArray jsonArray = (JSONArray) jsonEntry.getValue();
                for (int i = 0; i < jsonArray.size(); i++) {
                    if (jsonArray.get(i) instanceof JSONObject) {
                        traverseJsonData((JSONObject) jsonArray.get(i), String.format((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()) + "[%s]", i), context);
                    } else {
                        jsonArray.set(i, translate(String.format((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()) + "[%s]", i), jsonArray.get(i), context));
                    }
                }
            } else {
                jsonEntry.setValue(translate((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()),
                        jsonEntry.getValue() != null ? jsonEntry.getValue() : null, context));
            }
        }
    }
230722
public void setJsonPathTo(String path, Object value) {
        Object cleanValue = cleanupValue(value);
        String jsonPath = getPathExpr(path);
        String newContent = getPathHelper().updateJsonPathWithValue(content, jsonPath, cleanValue);
        content = newContent;
    }
607446
public function jsonUnSerialize(\SwaggerValidator\Common\Context $context, $jsonData)
    {
        if (!is_object($jsonData)) {
            $context->throwException('Mismatching type of JSON Data received', __METHOD__, __LINE__);
        }

        if (!($jsonData instanceof \stdClass)) {
            $context->throwException('Mismatching type of JSON Data received', __METHOD__, __LINE__);
        }

        foreach (get_object_vars($jsonData) as $key => $value) {

            if ($key == \SwaggerValidator\Common\FactorySwagger::KEY_DEFINITIONS) {
                continue;
            }

            $value      = $this->extractNonRecursiveReference($context, $value);
            $this->$key = \SwaggerValidator\Common\FactorySwagger::getInstance()->jsonUnSerialize($context->setDataPath($key), $this->getCleanClass(__CLASS__), $key, $value);
        }

        \SwaggerValidator\Common\CollectionReference::getInstance()->unserializeReferenceDefinitions($context);
        \SwaggerValidator\Common\CollectionReference::getInstance()->unserializeReferenceDefinitions($context);
        \SwaggerValidator\Common\CollectionReference::getInstance()->cleanReferenceDefinitions($context);
        \SwaggerValidator\Common\CollectionReference::getInstance()->jsonUnSerialize($context);

        $context->logDecode(get_class($this), __METHOD__, __LINE__);
    }
952569
public static Condition withPostBodyContainingJsonPath(final String pattern, final Object value) {
        return new Condition(input -> value.equals(JsonPath.parse(input.getPostBody()).read(pattern)));
    }
31855
private JsonPathMessageValidationContext getJsonPathMessageValidationContext(Element messageElement) {
        JsonPathMessageValidationContext context = new JsonPathMessageValidationContext();

        //check for validate elements, these elements can either have script, jsonPath or namespace validation information
        //for now we only handle jsonPath validation
        Map<String, Object> validateJsonPathExpressions = new HashMap<>();
        List<?> validateElements = DomUtils.getChildElementsByTagName(messageElement, "validate");
        if (validateElements.size() > 0) {
            for (Iterator<?> iter = validateElements.iterator(); iter.hasNext();) {
                Element validateElement = (Element) iter.next();
                extractJsonPathValidateExpressions(validateElement, validateJsonPathExpressions);
            }

            context.setJsonPathExpressions(validateJsonPathExpressions);
        }

        return context;
    }
153157
public void setEntityPath(java.util.Collection<ErrorRootCauseEntity> entityPath) {
        if (entityPath == null) {
            this.entityPath = null;
            return;
        }

        this.entityPath = new java.util.ArrayList<ErrorRootCauseEntity>(entityPath);
    }
1351492
public static JsonPathCursor createCursor(String attributePath) {
        ArrayList<Triple> triples = new ArrayList<Triple>(DEFAULT_PATH_ELEMENT_COUNT);
        int start = 0;
        int end;
        while (start < attributePath.length()) {
            boolean isArray = false;
            try {
                while (attributePath.charAt(start) == '[' || attributePath.charAt(start) == '.') {
                    start++;
                }
            } catch (IndexOutOfBoundsException e) {
                throw createIllegalArgumentException(attributePath);
            }
            end = start + 1;
            while (end < attributePath.length()) {
                char c = attributePath.charAt(end);
                if ('.' == c || '[' == c) {
                    break;
                } else if (']' == c) {
                    isArray = true;
                    break;
                }
                end++;
            }
            String part = attributePath.substring(start, end);

            Triple triple = new Triple(part, part.getBytes(UTF8_CHARSET), isArray);
            triples.add(triple);
            start = end + 1;
        }
        return new JsonPathCursor(attributePath, triples);
    }
738545
public static void startActivity(@NonNull Context context, @Nullable JSONArray jsonArray) {
        Intent intent = new Intent(context, JSONViewerActivity.class);
        Bundle bundle = new Bundle();
        if (jsonArray != null) {
            bundle.putString(JSON_ARRAY_STATE, jsonArray.toString());
        }
        intent.putExtras(bundle);
        context.startActivity(intent);
    }
348887
def set_context_json(self, jsonquery):
        '''
        
        '''

        # Make sure we are getting dicts
        if type(jsonquery) != dict:
            raise IOError("set_json_context() method can be called only with dictionaries, you gave me a '{}'".format(type(jsonquery)))

        # Set we will answer json to this request
        self.json = True

        # Transfer keys
        newget = {}
        for key in ['search', 'search_filter_button', 'page', 'pages_to_bring', 'rowsperpage', 'filters', 'year', 'month', 'day', 'hour', 'minute', 'second']:
            if key in jsonquery:
                newget[key] = jsonquery[key]

        # Add transformed ordering
        json_ordering = jsonquery.get('ordering', None)
        if json_ordering:
            # Convert to list
            ordering = []
            for key in json_ordering:
                ordering.append({key: jsonquery['ordering'][key]})

            # Order the result from ordering
            # ordering = sorted(ordering, key=lambda x: abs(x.values()[0]))
            ordering = sorted(ordering, key=lambda x: abs(list(x.values())[0]))
            # Save ordering
            newget['ordering'] = []
            for orderer in ordering:
                key = list(orderer.keys())[0]
                value = orderer[key]
                if value > 0:
                    value = 'asc'
                elif value < 0:
                    value = 'desc'
                else:
                    value = None
                if value:
                    newget['ordering'].append({key: value})

        # Get listid
        newget['listid'] = jsonquery.get("listid", None)

        # Get elementid
        newget['elementid'] = jsonquery.get("elementid", None)

        # Return new get
        return newget
537164
@Override
    public List<String> setTargetHostsFromJsonPath(String jsonPath,
            String sourcePath, HostsSourceType sourceType)
            throws TargetHostsLoadException {

        List<String> targetHosts = new ArrayList<String>();
        try {
            String content = getContentFromPath(sourcePath, sourceType);
            targetHosts = JsonPath.read(content, jsonPath);

        } catch (IOException e) {
            throw new TargetHostsLoadException("IEException when reading  "
                    + sourcePath, e);
        }

        return targetHosts;
    }
245443
public static function parse(Composer $composer, $webPath, $path, array $jsonData)
    {
        $name = $jsonData['name'];
        $class = self::parseClass($jsonData);
        $constraint = self::parseConstraint($jsonData);
        $valid = self::parseValid($composer, $class, $constraint);

        return new self($name, $class, $path, $webPath, $constraint, $valid);
    }
744929
function Json(filepath) {
  this.filepath = filepath;
  this.dirname = undefined;
  this.json = undefined;
  this.realpath = undefined;
}
653965
public AbstractCharSequenceAssert<?, String> jsonPathAsString(String path) {
        return Assertions.assertThat(actual.read(path, String.class));
    }
554147
protected function checkJsonObject(\SwaggerValidator\Common\Context $context, &$jsonData)
    {
        if (!is_object($jsonData)) {
            $context->throwException('Mismatching type of JSON Data received', get_class($this) . '::' . __METHOD__, __LINE__);
        }

        if (!($jsonData instanceof \stdClass)) {
            $context->throwException('Mismatching type of JSON Data received', get_class($this) . '::' . __METHOD__, __LINE__);
        }

        return true;
    }
590226
private JsonObject load(Path path) throws IOException {
    try (InputStream stream = Resources.getResource(path.toString()).openStream()) {
      return (JsonObject) JSON_PARSER.parse(new InputStreamReader(stream));
    }
  }
939245
private JSONObject getJSONFromPath(String path) throws LRException
    {
        JSONObject json = null;
        String jsonTxt = null;
        
        try
        {
            jsonTxt = LRClient.executeJsonGet(importProtocol + "://" + nodeHost + path);
        }
        catch(Exception e)
        {
            throw new LRException(LRException.IMPORT_FAILED);
            //e.printStackTrace();
        }
        
        try
        {
            json = new JSONObject(jsonTxt);
        }
        catch(JSONException e)
        {
            throw new LRException(LRException.JSON_IMPORT_FAILED);
            //e.printStackTrace();
        }

        return json;
    }
1102348
def parse_json_path(self, jsonpath):

        
        if jsonpath not in self.parsed:
            try:
                self.parsed[jsonpath] = self.parser(jsonpath)
            except Exception:
                self.log("Invalid Json Path: " + jsonpath, "error")
                raise InvalidJsonPathError("Invalid Json Path")

        return self.parsed[jsonpath]