Package net.minidev.json.parser
Class JSONParser
- java.lang.Object
-
- net.minidev.json.parser.JSONParser
-
public class JSONParser extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static intACCEPT_LEADING_ZEROThrows exception on excessive 0 leading in digitsstatic intACCEPT_NANParse NaN as Float.NaNstatic intACCEPT_NON_QUOTEallow non quoted teststatic intACCEPT_SIMPLE_QUOTEallow simple quote as String quoting charstatic intACCEPT_TAILLING_DATAIf enabled json-smart will throws exception if datas are present after the end of the Json data.static intACCEPT_TAILLING_SPACEsmart mode, fastest parsing mode.static intACCEPT_USELESS_COMMAThrows exception on useless comma in object and arraystatic intDEFAULT_PERMISSIVE_MODEDefault json-smart processing modestatic intIGNORE_CONTROL_CHARIgnore control char in input text.private intmodestatic intMODE_JSON_SIMPLEParse Object like json-simple Best for an iso-bug json-simple API port.static intMODE_PERMISSIVEsmart mode, fastest parsing mode.static intMODE_RFC4627strict RFC4627 mode.static intMODE_STRICTESTStrictest parsing modeprivate JSONParserInputStreampBinStreamprivate JSONParserByteArraypBytesprivate JSONParserReaderpStreamprivate JSONParserStringpStringstatic intUSE_HI_PRECISION_FLOATAllow Json-smart to use Double or BigDecimal to store floating point value You may need to disable HI_PRECISION_FLOAT feature on 32bit to improve parsing performances.static intUSE_INTEGER_STORAGEUse int datatype to store number when it's possible.
-
Constructor Summary
Constructors Constructor Description JSONParser()Deprecated.prefer usage of new JSONParser(JSONParser.MODE_*)JSONParser(int permissifMode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private JSONParserInputStreamgetPBinStream()cached construcorprivate JSONParserByteArraygetPBytes()cached construcorprivate JSONParserReadergetPStream()private JSONParserStringgetPString()cached construcorjava.lang.Objectparse(byte[] in)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory<T> Tparse(byte[] in, java.lang.Class<T> mapTo)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory<T> Tparse(byte[] in, JsonReaderI<T> mapper)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactoryjava.lang.Objectparse(java.io.InputStream in)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory<T> Tparse(java.io.InputStream in, java.lang.Class<T> mapTo)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory<T> Tparse(java.io.InputStream in, JsonReaderI<T> mapper)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactoryjava.lang.Objectparse(java.io.Reader in)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory<T> Tparse(java.io.Reader in, java.lang.Class<T> mapTo)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory<T> Tparse(java.io.Reader in, JsonReaderI<T> mapper)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactoryjava.lang.Objectparse(java.lang.String in)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory<T> Tparse(java.lang.String in, java.lang.Class<T> mapTo)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory<T> Tparse(java.lang.String in, JsonReaderI<T> mapper)use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory
-
-
-
Field Detail
-
ACCEPT_SIMPLE_QUOTE
public static final int ACCEPT_SIMPLE_QUOTE
allow simple quote as String quoting char- See Also:
- Constant Field Values
-
ACCEPT_NON_QUOTE
public static final int ACCEPT_NON_QUOTE
allow non quoted test- See Also:
- Constant Field Values
-
ACCEPT_NAN
public static final int ACCEPT_NAN
Parse NaN as Float.NaN- See Also:
- Constant Field Values
-
IGNORE_CONTROL_CHAR
public static final int IGNORE_CONTROL_CHAR
Ignore control char in input text.- See Also:
- Constant Field Values
-
USE_INTEGER_STORAGE
public static final int USE_INTEGER_STORAGE
Use int datatype to store number when it's possible.- Since:
- 1.0.7
- See Also:
- Constant Field Values
-
ACCEPT_LEADING_ZERO
public static final int ACCEPT_LEADING_ZERO
Throws exception on excessive 0 leading in digits- Since:
- 1.0.7
- See Also:
- Constant Field Values
-
ACCEPT_USELESS_COMMA
public static final int ACCEPT_USELESS_COMMA
Throws exception on useless comma in object and array- Since:
- 1.0.8
- See Also:
- Constant Field Values
-
USE_HI_PRECISION_FLOAT
public static final int USE_HI_PRECISION_FLOAT
Allow Json-smart to use Double or BigDecimal to store floating point value You may need to disable HI_PRECISION_FLOAT feature on 32bit to improve parsing performances.- Since:
- 1.0.9
- See Also:
- Constant Field Values
-
ACCEPT_TAILLING_DATA
public static final int ACCEPT_TAILLING_DATA
If enabled json-smart will throws exception if datas are present after the end of the Json data.- Since:
- 1.0.9-2
- See Also:
- Constant Field Values
-
ACCEPT_TAILLING_SPACE
public static final int ACCEPT_TAILLING_SPACE
smart mode, fastest parsing mode. accept lots of non standard json syntax- Since:
- 2.0.1
- See Also:
- Constant Field Values
-
MODE_PERMISSIVE
public static final int MODE_PERMISSIVE
smart mode, fastest parsing mode. accept lots of non standard json syntax- Since:
- 1.0.6
- See Also:
- Constant Field Values
-
MODE_RFC4627
public static final int MODE_RFC4627
strict RFC4627 mode. slower than PERMISIF MODE.- Since:
- 1.0.6
- See Also:
- Constant Field Values
-
MODE_JSON_SIMPLE
public static final int MODE_JSON_SIMPLE
Parse Object like json-simple Best for an iso-bug json-simple API port.- Since:
- 1.0.7
- See Also:
- Constant Field Values
-
MODE_STRICTEST
public static final int MODE_STRICTEST
Strictest parsing mode- Since:
- 2.0.1
- See Also:
- Constant Field Values
-
DEFAULT_PERMISSIVE_MODE
public static int DEFAULT_PERMISSIVE_MODE
Default json-smart processing mode
-
mode
private int mode
-
pBinStream
private JSONParserInputStream pBinStream
-
pBytes
private JSONParserByteArray pBytes
-
pStream
private JSONParserReader pStream
-
pString
private JSONParserString pString
-
-
Method Detail
-
getPStream
private JSONParserReader getPStream()
-
getPBinStream
private JSONParserInputStream getPBinStream()
cached construcor- Returns:
-
getPString
private JSONParserString getPString()
cached construcor- Returns:
-
getPBytes
private JSONParserByteArray getPBytes()
cached construcor- Returns:
-
parse
public java.lang.Object parse(byte[] in) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
parse
public <T> T parse(byte[] in, JsonReaderI<T> mapper) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
parse
public <T> T parse(byte[] in, java.lang.Class<T> mapTo) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
parse
public java.lang.Object parse(java.io.InputStream in) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
parse
public <T> T parse(java.io.InputStream in, JsonReaderI<T> mapper) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
parse
public <T> T parse(java.io.InputStream in, java.lang.Class<T> mapTo) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
parse
public java.lang.Object parse(java.io.Reader in) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
parse
public <T> T parse(java.io.Reader in, JsonReaderI<T> mapper) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
parse
public <T> T parse(java.io.Reader in, java.lang.Class<T> mapTo) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
parse
public java.lang.Object parse(java.lang.String in) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
parse
public <T> T parse(java.lang.String in, JsonReaderI<T> mapper) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
parse
public <T> T parse(java.lang.String in, java.lang.Class<T> mapTo) throws ParseExceptionuse to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory- Throws:
ParseException
-
-