/** * Parses any object from a source. For any valid JSON, returns either a null (for the JSON string 'null'), a * {@link String}, a {@link Number}, a {@link Boolean}, a {@link JsonObject} or a {@link JsonArray}. * * <pre> * Object json = {@link JsonParser}.any().from("{\"a\":[true,false], \"b\":1}"); * Number json = ({@link Number}){@link JsonParser}.any().from("123.456e7"); * </pre> */ public static JsonParserContext<Object> any() { return new JsonParserContext<Object>(Object.class); }
@Override public Array parseArray(String json) throws JsonParserException { return JsonParser.array().from(json); }
@Override public Array parseArray(String json) throws JsonParserException { return JsonParser.array().from(json); }
@Override public Object parse(String json) throws JsonParserException { return JsonParser.object().from(json); }
@Override public Array parseArray(String json) throws JsonParserException { return JsonParser.array().from(json); }
@Override public Object parse(String json) throws JsonParserException { return JsonParser.object().from(json); }
/** * Parses a {@link JsonArray} from a source. * * <pre> * JsonArray json = {@link JsonParser}.array().from("[1, {\"a\":[true,false], \"b\":1}]"); * </pre> */ public static JsonParserContext<JsonArray> array() { return new JsonParserContext<JsonArray>(JsonArray.class); }
/** * Parses any object from a source. For any valid JSON, returns either a null (for the JSON string 'null'), a * {@link String}, a {@link Number}, a {@link Boolean}, a {@link JsonObject} or a {@link JsonArray}. * * <pre> * Object json = {@link JsonParser}.any().from("{\"a\":[true,false], \"b\":1}"); * Number json = ({@link Number}){@link JsonParser}.any().from("123.456e7"); * </pre> */ public static JsonParserContext<Object> any() { return new JsonParserContext<Object>(Object.class); }
/** * Parses a {@link JsonObject} from a source. * * <pre> * JsonObject json = {@link JsonParser}.object().from("{\"a\":[true,false], \"b\":1}"); * </pre> */ public static JsonParserContext<JsonObject> object() { return new JsonParserContext<JsonObject>(JsonObject.class); }
/** * Parses a {@link JsonArray} from a source. * * <pre> * JsonArray json = {@link JsonParser}.array().from("[1, {\"a\":[true,false], \"b\":1}]"); * </pre> */ public static JsonParserContext<JsonArray> array() { return new JsonParserContext<JsonArray>(JsonArray.class); }
/** * Parses a {@link JsonObject} from a source. * * <pre> * JsonObject json = {@link JsonParser}.object().from("{\"a\":[true,false], \"b\":1}"); * </pre> */ public static JsonParserContext<JsonObject> object() { return new JsonParserContext<JsonObject>(JsonObject.class); }
/** * Parses any object from a source. For any valid JSON, returns either a null (for the JSON string 'null'), a * {@link String}, a {@link Number}, a {@link Boolean}, a {@link JsonObject} or a {@link JsonArray}. * * <pre> * Object json = {@link JsonParser}.any().from("{\"a\":[true,false], \"b\":1}"); * Number json = ({@link Number}){@link JsonParser}.any().from("123.456e7"); * </pre> */ public static JsonParserContext<Object> any() { return new JsonParserContext<Object>(Object.class); }
/** * Parses a {@link JsonArray} from a source. * * <pre> * JsonArray json = {@link JsonParser}.array().from("[1, {\"a\":[true,false], \"b\":1}]"); * </pre> */ public static JsonParserContext<JsonArray> array() { return new JsonParserContext<JsonArray>(JsonArray.class); }
@Override public Object parse(String json) throws JsonParserException { return JsonParser.object().from(json); }
/** * Parses a {@link JsonObject} from a source. * * <pre> * JsonObject json = {@link JsonParser}.object().from("{\"a\":[true,false], \"b\":1}"); * </pre> */ public static JsonParserContext<JsonObject> object() { return new JsonParserContext<JsonObject>(JsonObject.class); }