Parses the given JSON data as a hash.
@param parser {@link JsonPullParser} with some JSON-formatted data
@return {@link JsonHash}
@throws IOException
@throws JsonFormatException
@author vvakame
497449
public static JsonHash fromParser(JsonPullParser parser) throws IOException,
			JsonFormatException {
		State state = parser.getEventType();

		if (state == State.VALUE_NULL) {
			return null;
		} else if (state != State.START_HASH) {
			throw new JsonFormatException("unexpected token. token=" + state, parser);
		}

		JsonHash jsonHash = new JsonHash();
		while ((state = parser.lookAhead()) != State.END_HASH) {
			state = parser.getEventType();
			if (state != State.KEY) {
				throw new JsonFormatException("unexpected token. token=" + state, parser);
			}
			String key = parser.getValueString();
			state = parser.lookAhead();
			jsonHash.put(key, getValue(parser), state);
		}
		parser.getEventType();

		return jsonHash;
	}
432596
public static List<Integer> parserIntegerList(JsonPullParser parser) throws IOException,
			JsonFormatException {

		State eventType = parser.getEventType();
		if (eventType == State.VALUE_NULL) {
			return null;
		}
		if (eventType != State.START_ARRAY) {
			throw new IllegalStateException("not started brace!");
		}
		List<Integer> list = new ArrayList<Integer>();
		while (parser.lookAhead() != State.END_ARRAY) {
			eventType = parser.getEventType();
			if (eventType == State.VALUE_NULL) {
				list.add(null);
			} else if (eventType == State.VALUE_LONG) {
				list.add((int) parser.getValueLong());
			} else {
				throw new IllegalStateException("unexpected state. expected=VALUE_LONG, but get="
						+ eventType.toString());
			}
		}
		parser.getEventType();
		return list;
	}
318880
public static void acceptsJson(OptionParser parser) {
        parser.acceptsAll(Arrays.asList(OPT_J, OPT_JSON),
                          "fetch key/entry by key value of json type")
              .withRequiredArg()
              .describedAs("key-list")
              .withValuesSeparatedBy(',')
              .ofType(String.class);
    }
716188
public static Character parserCharacter(JsonPullParser parser) throws IOException,
			JsonFormatException {

		State eventType = parser.getEventType();
		if (eventType == State.VALUE_NULL) {
			return null;
		} else if (eventType == State.VALUE_STRING) {
			String str = parser.getValueString();
			if (str.length() != 1) {
				throw new IllegalStateException(
						"unexpected value. expecte string size is 1. but get=" + str);
			}
			return str.charAt(0);
		} else {
			throw new IllegalStateException("unexpected state. expected=VALUE_STRING, but get="
					+ eventType.toString());
		}
	}
282190
public static Object[] parse(String json, Class<?>[] types,
                                 Converter<Object, Map<String, Object>> mc) throws ParseException {
        StringReader reader = new StringReader(json);
        try {
            return (Object[]) parse(reader, types, mc);
        } catch (IOException e) {
            throw new ParseException(e.getMessage(), 0);
        } finally {
            reader.close();
        }
    }
842277
def sym_hash_JSON(str)
      return nil if str.nil?
      case str
        when String
          raise ArgumentError.new('Can not parse an empty JSON string') if str.empty?
          to_sym_hash(JSON.parse(str))
        when Array, Hash
          to_sym_hash(str)
        else
          str
      end
    end
836145
protected <T> T parse(JsonReaderI<T> mapper) throws ParseException {
		this.pos = -1;
		T result;
		try {
			read();
			result = readFirst(mapper);
			if (checkTaillingData) {
				if (!checkTaillingSpace)
					skipSpace();
				if (c != EOI)
					throw new ParseException(pos - 1, ERROR_UNEXPECTED_TOKEN, c);
			}
		} catch (IOException e) {
			throw new ParseException(pos, e);
		}
		xs = null;
		xo = null;
		return result;
	}
465563
@NonNull
    static List<Address> parseJson(final byte[] jsonData,
                                   final int maxResults,
                                   final boolean parseAddressComponents)
            throws GeocoderException {
        try {
            final String jsonString = new String(jsonData, Charset.forName("UTF-8"));
            final JSONObject jsonObject = new JSONObject(jsonString);

            if (!jsonObject.has(STATUS)) {
                throw new GeocoderException(new JSONException("No \"status\" field"));
            }

            final Status status = Status.fromString(jsonObject.getString(STATUS));
            switch (status) {
                case OK:
                    if (jsonObject.has(RESULTS)) {
                        return parseResults(maxResults, parseAddressComponents, jsonObject);
                    }
                    return new ArrayList<>();

                case ZERO_RESULTS:
                    return new ArrayList<>();

                default:
                    final GeocoderException e = GeocoderException.forStatus(status);
                    try {
                        if (jsonObject.has(ERROR_MESSAGE)) {
                            e.setErrorMessage(jsonObject.getString(ERROR_MESSAGE));
                        }
                    } catch (JSONException ignored) {
                    }
                    throw e;
            }
        } catch (JSONException e) {
            throw new GeocoderException(e);
        }
    }
632145
public static Boolean parserBoolean(JsonPullParser parser) throws IOException,
			JsonFormatException {

		State eventType = parser.getEventType();
		if (eventType == State.VALUE_NULL) {
			return null;
		} else if (eventType == State.VALUE_BOOLEAN) {
			return parser.getValueBoolean();
		} else {
			throw new IllegalStateException("unexpected state. expected=VALUE_BOOLEAN, but get="
					+ eventType.toString());
		}
	}
695079
public void setParser(Map<JsonParser.Feature, Boolean> parser) {
        if (CollectionUtils.isNotEmpty(parser)) {
            this.parser = parser;
        }
    }
854452
public static Long parserLong(JsonPullParser parser) throws IOException, JsonFormatException {

		State eventType = parser.getEventType();
		if (eventType == State.VALUE_NULL) {
			return null;
		} else if (eventType == State.VALUE_LONG) {
			return parser.getValueLong();
		} else {
			throw new IllegalStateException("unexpected state. expected=VALUE_LONG, but get="
					+ eventType.toString());
		}
	}
1091613
public static Object parseStrict(String s) throws ParseException {
		return new JSONParser(MODE_RFC4627).parse(s, defaultReader.DEFAULT);
	}
450738
protected Object parse(String query) throws IOException {
        JsonRule jsonRule = mapper.readValue(query, JsonRule.class);
        // json rule parse
        return new JsonRuleParser(getBuilderType(), groupParser, ruleParsers, ruleFilters).parse(jsonRule);
    }
569210
public static JsonArray fromParser(JsonPullParser parser) throws IOException,
			JsonFormatException {
		State state = parser.getEventType();

		if (state == State.VALUE_NULL) {
			return null;
		} else if (state != State.START_ARRAY) {
			throw new JsonFormatException("unexpected token. token=" + state, parser);
		}

		JsonArray jsonArray = new JsonArray();
		while ((state = parser.lookAhead()) != State.END_ARRAY) {
			jsonArray.add(getValue(parser), state);
		}
		parser.getEventType();

		return jsonArray;
	}
1047131
public T parse(byte[] byteArray) throws IOException {
        JsonParser jsonParser = LoganSquare.JSON_FACTORY.createParser(byteArray);
        jsonParser.nextToken();
        return parse(jsonParser);
    }
552980
public static Double parserDouble(JsonPullParser parser) throws IOException,
			JsonFormatException {

		State eventType = parser.getEventType();
		if (eventType == State.VALUE_NULL) {
			return null;
		} else if (eventType == State.VALUE_DOUBLE) {
			return parser.getValueDouble();
		} else {
			throw new IllegalStateException("unexpected state. expected=VALUE_DOUBLE, but get="
					+ eventType.toString());
		}
	}
45147
public static <E> Map<String, E> parseMap(String jsonString, Class<E> jsonObjectClass) throws IOException {
        return mapperFor(jsonObjectClass).parseMap(jsonString);
    }