Extracts the dates from a JSON array.
@param json the JSON array where the dates are stored in.
@return list of the extracted dates.
498197
private SortedSet<Date> readDates(JSONValue json) {

        JSONArray array = null == json ? null : json.isArray();
        if (null != array) {
            SortedSet<Date> result = new TreeSet<>();
            for (int i = 0; i < array.size(); i++) {
                Date d = readOptionalDate(array.get(i));
                if (null != d) {
                    result.add(d);
                }
            }
            return result;
        }
        return new TreeSet<>();
    }
1016645
protected void parse(String json) {
        logger.entering(json);

        try {
            Gson gson = new Gson();
            BaseLog baseLog = gson.fromJson(json, this.getClass());
            this.msg = baseLog.msg;
            this.screen = baseLog.screen;
            this.location = baseLog.location;
            this.href = baseLog.href;
        } catch (JsonSyntaxException e) {
            // If not JSON string then treat this as an message
            this.msg = json;
        }

        logger.exiting();
    }
893583
public void readJson(@Nullable final JsonObject json) {
    if (null == json) return;
    min = json.get("min").getAsDouble();
    max = json.get("max").getAsDouble();
    negatives = json.get("negatives").getAsInt();
    positives = json.get("positives").getAsInt();
    zeros = json.get("zeros").getAsInt();
    sum0 = json.get("sum0").getAsInt();
    sum1 = json.get("sum1").getAsDouble();
    sum2 = json.get("sum2").getAsDouble();
    sumLog = json.get("sumLog").getAsDouble();
  }
1301982
public static JWSObject deserialize(String json) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        return mapper.readValue(json, JWSObject.class);
    }
1163045
private JSONValue datesToJsonArray(Collection<Date> dates) {

        if (null != dates) {
            JSONArray result = new JSONArray();
            for (Date d : dates) {
                result.set(result.size(), dateToJson(d));
            }
            return result;
        }
        return null;
    }
28280
public static boolean allJSONArrays(JSONArray array) throws JSONException {
        for (int i = 0; i < array.length(); ++i) {
            if (!(array.get(i) instanceof JSONArray)) {
                return false;
            }
        }
        return true;
    }
852376
@SuppressWarnings("UnusedDeclaration")
  public static Bindings fromJson( String json )
  {
    try
    {
      return PARSER.get().parseJson( json );
    }
    catch( ScriptException e )
    {
      throw new RuntimeException( e );
    }
  }
501244
public List<Object> getAllJsonPath(String json, String jsonPath) {
        List<Object> result;
        if (JsonPath.isPathDefinite(jsonPath)) {
            Object val = getJsonPath(json, jsonPath);
            if (val == null) {
                result = Collections.emptyList();
            } else {
                result = Collections.singletonList(val);
            }
        } else {
            result = parseJson(json).read(jsonPath);
        }
        return result;
    }
1037317
private String[] getDate( String date ) {

        String dateStr = "20" + date.substring(4) + ":" + date.substring(2, 4) + ":" + date.substring(0, 2);

        String[] dateArray = new String[11];

        for( int i = 0; i < dateStr.length(); i++ )
            dateArray[i] = dateStr.substring(i, i + 1);
        dateArray[10] = "";

        return dateArray;
    }
1129987
private List<UrlPattern> parseJson(String json) {
        List<UrlPattern> urlPatterns = new ArrayList<>();
        try {
            List<Map<String, Object>> ups = MAPPER.readValue(json, List.class);
            for (Map<String, Object> up : ups) {
                try {
                    UrlPattern urlPattern = new UrlPattern();
                    urlPatterns.add(urlPattern);
                    urlPattern.setUrlPattern(up.get("urlPattern").toString());
                    List<Map<String, Object>> pageTemplates = (List<Map<String, Object>>) up.get("pageTemplates");
                    for (Map<String, Object> pt : pageTemplates) {
                        try {
                            HtmlTemplate htmlTemplate = new HtmlTemplate();
                            urlPattern.addHtmlTemplate(htmlTemplate);
                            htmlTemplate.setTemplateName(pt.get("templateName").toString());
                            htmlTemplate.setTableName(pt.get("tableName").toString());
                            List<Map<String, Object>> cssPaths = (List<Map<String, Object>>) pt.get("cssPaths");
                            for (Map<String, Object> cp : cssPaths) {
                                try {
                                    CssPath cssPath = new CssPath();
                                    htmlTemplate.addCssPath(cssPath);
                                    cssPath.setCssPath(cp.get("cssPath").toString());
                                    cssPath.setFieldName(cp.get("fieldName").toString());
                                    cssPath.setFieldDescription(cp.get("fieldDescription").toString());
                                    List<Map<String, Object>> extractFunctions = (List<Map<String, Object>>) cp.get("extractFunctions");
                                    for (Map<String, Object> pf : extractFunctions) {
                                        try {
                                            ExtractFunction extractFunction = new ExtractFunction();
                                            cssPath.addExtractFunction(extractFunction);
                                            extractFunction.setExtractExpression(pf.get("extractExpression").toString());
                                            extractFunction.setFieldName(pf.get("fieldName").toString());
                                            extractFunction.setFieldDescription(pf.get("fieldDescription").toString());
                                        } catch (Exception e) {
                                            LOGGER.error("JSON抽取失败", e);
                                        }
                                    }
                                } catch (Exception e) {
                                    LOGGER.error("JSON抽取失败", e);
                                }
                            }
                        } catch (Exception e) {
                            LOGGER.error("JSON抽取失败", e);
                        }
                    }
                } catch (Exception e) {
                    LOGGER.error("JSON抽取失败", e);
                }
            }
        } catch (Exception e) {
            LOGGER.error("JSON抽取失败", e);
        }
        return urlPatterns;
    }
278196
private function jsonToArray($json)
	{
		try {
			$data = json_decode($json, true);
			if(is_array($data)) {
				return $data;
			}
			else {
				$this->error = 'The given data string was not json';
				return [];
			}
		}
		catch(Exception $e) {
			$this->error = $e;
		}
	}
660854
public JSONArray getJSONArray(int index) throws JSONException {
    Object o = get(index);
    if (o instanceof JSONArray) {
      return (JSONArray) o;
    }
    throw new JSONException("JSONArray[" + index + "] is not a JSONArray.");
  }
807260
public T get(String json) throws IOException, JsonFormatException {
		JsonPullParser parser = JsonPullParser.newParser(json);
		return get(parser, null);
	}
1210677
private Links getLinks(String json) {

		try {
			return this.mapper.readValue(json, UberDocument.class).getUber().getLinks();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
278353
public static Coordinate fromJson(Map<String, ?> json) {
        return Coordinate.of(Intrinsic.getTable(json), Intrinsic.getId(json));
    }
327568
private SortedSet<WeekOfMonth> readWeeksOfMonth(JSONObject json) {

        try {
            JSONArray array = json.getJSONArray(JsonKey.PATTERN_WEEKS_OF_MONTH);
            if (null != array) {
                SortedSet<WeekOfMonth> result = new TreeSet<>();
                for (int i = 0; i < array.length(); i++) {
                    try {
                        WeekOfMonth week = WeekOfMonth.valueOf(array.getString(i));
                        result.add(week);
                    } catch (JSONException e) {
                        LOG.debug("Could not read week of month from JSON. Skipping that particular week of month.", e);
                    }
                }
                return result;
            }
        } catch (JSONException e) {
            LOG.debug("Could not read week of month information from JSON", e);
        }
        return new TreeSet<>();
    }
986295
private function getArray($json) : array
    {
        $data = json_decode($json, true);
        if ($error = json_last_error() !== JSON_ERROR_NONE) {
            throw new RuntimeException(json_last_error_msg());
        }

        return $data;
    }