| Modifier and Type | Method and Description |
|---|---|
JSONConfig |
JSONConfig.addDateParseFormat(DateFormat fmt)
Add a date parsing format to the list of parsing formats.
|
JSONConfig |
JSONConfig.addDateParseFormats(Collection<? extends DateFormat> fmts)
Add a collection of date parsing formats to the list of date parsing
formats.
|
JSONConfig |
JSONConfig.addNumberFormat(Class<? extends Number> numericClass,
NumberFormat fmt)
Add a number format for a particular type that extends Number.
|
JSONConfig |
JSONConfig.addNumberFormat(Number numericType,
NumberFormat fmt)
Add a number format for a particular type that extends Number.
|
JSONConfig |
JSONConfig.addNumberFormats(Map<Class<? extends Number>,NumberFormat> numFmtMap)
Add a map of number formats to the current map of number formats.
|
JSONConfig |
JSONConfig.addReflectClass(Object obj)
Add the class of the given object to the set of classes that
automatically get reflected.
|
JSONConfig |
JSONConfig.addReflectClassByName(String className)
Add the given class to the set of classes to be reflected.
|
JSONConfig |
JSONConfig.addReflectClasses(Collection<?> classes)
Add the classes of all of the given objests to the list of classes
that automatically get reflected.
|
JSONConfig |
JSONConfig.clearDateGenFormat()
Clear date generation format.
|
JSONConfig |
JSONConfig.clearDateParseFormats()
Clear any date parse formats.
|
JSONConfig |
JSONConfig.clearNumberFormats()
Clear all number formats.
|
JSONConfig |
JSONConfig.clearReflectClasses()
Clear all reflection classes, disabling all automatic reflection.
|
JSONConfig |
JSONConfig.clone()
Return a clone of this object.
|
JSONConfig |
JsonObject.getJSONConfig()
Get the JSONConfig or null if there isn't one.
|
JSONConfig |
JSONConfig.removeNumberFormat(Class<? extends Number> numericClass)
Remove the requested class from the number formats that
this config knows about.
|
JSONConfig |
JSONConfig.removeNumberFormat(Number num)
Remove the requested class from the number formats that
this config knows about.
|
JSONConfig |
JSONConfig.removeReflectClass(Object obj)
Remove the given class from the list of automatically reflected
classes.
|
JSONConfig |
JSONConfig.removeReflectClasses(Collection<?> classes)
Remove the given classes from the list of automatically reflected
classes.
|
JSONConfig |
JSONConfig.setAllowReservedWordsInIdentifiers(boolean allowReservedWordsInIdentifiers)
If true then reserved words will be allowed in identifiers even when
identifier validation is enabled.
|
JSONConfig |
JSONConfig.setBadCharacterPolicy(int badCharacterPolicy)
Convenience method to call both
setUnmatchedSurrogatePolicy(int)
and setUndefinedCodePointPolicy(int) using the same value. |
JSONConfig |
JSONConfig.setCacheReflectionData(boolean cacheReflectionData)
If true, then when an object is reflected its reflection data
will be cached to improve performance on subsequent reflections
of objects of its class.
|
JSONConfig |
JSONConfig.setDateGenFormat(DateFormat fmt)
Set the date string generation format used when encodeDatesAsStrings or
encodeDatesAsObjects are true.
|
JSONConfig |
JSONConfig.setDetectDataStructureLoops(boolean detectDataStructureLoops)
Enable or disable data structure loop detection.
|
JSONConfig |
JSONConfig.setEncodeDatesAsObjects(boolean encodeDatesAsObjects)
If true, then
Date objects will be encoded as
Javascript dates, using new Date(dateString). |
JSONConfig |
JSONConfig.setEncodeDatesAsStrings(boolean encodeDatesAsStrings)
If true, then
Date objects will be encoded as ISO 8601 date
strings or a custom date format if you have called
setDateGenFormat(DateFormat). |
JSONConfig |
JSONConfig.setEncodeNumericStringsAsNumbers(boolean encodeNumericStringsAsNumbers)
If true, then strings will be checked for number patterns and if they
look like numbers, then they won't be quoted.
|
JSONConfig |
JSONConfig.setEscapeBadIdentifierCodePoints(boolean escapeBadIdentifierCodePoints)
If true, then any bad code points in identifiers will be escaped.
|
JSONConfig |
JSONConfig.setEscapeNonAscii(boolean escapeNonAscii)
If you want non-ascii characters encoded as Unicode escapes in strings
and identifiers, you can do that by setting this to true.
|
JSONConfig |
JSONConfig.setEscapeSurrogates(boolean escapeSurrogates)
If true then all surrogates will be escaped in strings and identifiers
and escapeNonAscii will be forced to false.
|
JSONConfig |
JSONConfig.setFastStrings(boolean fastStrings)
If true, then string values will be copied to the output with no escaping
or validation.
|
JSONConfig |
JSONConfig.setFullJSONIdentifierCodePoints(boolean fullJSONIdentifierCodePoints)
If true, then the full set of identifier code points permitted by the
JSON standard will be allowed instead of the more restrictive set
permitted by the ECMAScript standard.
|
JSONConfig |
JSONConfig.setIndentPadding(IndentPadding indentPadding)
Set the padding object.
|
JSONConfig |
JSONConfig.setLocale(Locale locale)
Set the locale.
|
JSONConfig |
JSONConfig.setPassThroughEscapes(boolean passThroughEscapes)
If true, then legal escapes in strings will be passed through unchanged.
|
JSONConfig |
JSONConfig.setPreciseNumbers(boolean preciseNumbers)
If true then integer numbers which are not exactly representable by a 64
bit double precision floating point number will be quoted in the output.
|
JSONConfig |
JSONConfig.setQuoteIdentifier(boolean quoteIdentifier)
Control whether identifiers are quoted or not.
|
JSONConfig |
JSONConfig.setReflectionPrivacy(int reflectionPrivacy)
Set the privacy level for reflection.
|
JSONConfig |
JSONConfig.setReflectUnknownObjects(boolean reflectUnknownObjects)
Set the unknown object reflection encoding policy.
|
JSONConfig |
JSONConfig.setSmallNumbers(boolean smallNumbers)
If true then
JSONParser will attempt to minimize the
storage used for all numbers. |
JSONConfig |
JSONConfig.setUndefinedCodePointPolicy(int undefinedCodePointPolicy)
Tell JSONUtil what to do when it encounters undefined code points in strings
and identifiers.
|
JSONConfig |
JSONConfig.setUnEscapeWherePossible(boolean unEscapeWherePossible)
If true then where possible, undo inline escapes in strings before going
through normal string processing.
|
JSONConfig |
JSONConfig.setUnmatchedSurrogatePolicy(int unmatchedSurrogatePolicy)
Tell JSONUtil what to do when it encounters unmatched surrogates in strings
and identifiers.
|
JSONConfig |
JSONConfig.setUseECMA6(boolean useECMA6)
If you set this to true, then when JSONUtil generates Unicode
escapes, it will use ECMAScript 6 code point escapes if they are shorter
than code unit escapes.
|
JSONConfig |
JSONConfig.setUsePrimitiveArrays(boolean usePrimitiveArrays)
If true, then when
JSONParser encounters a JSON array of non-null
wrappers of primitives and those primitives are all compatible with each
other, then instead of an ArrayList of wrappers for those
primitives it will create an array of those primitives in order to save
memory. |
JSONConfig |
JSONConfig.setValidatePropertyNames(boolean validatePropertyNames)
If true, then property names will be validated.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
JSONUtil.checkValidJavascriptPropertyName(String propertyName,
JSONConfig cfg)
Checks if the input string represents a valid Javascript property name.
|
static boolean |
JSONUtil.isValidJavascriptPropertyName(String propertyName,
JSONConfig cfg)
Return true if the input string is a valid Javascript property name.
|
static Object |
JSONParser.parseJSON(Reader json,
JSONConfig cfg)
Parse JSON from an input stream.
|
static Object |
JSONParser.parseJSON(String json,
JSONConfig cfg)
Parse a string of JSON data.
|
void |
JsonObject.setJSONConfig(JSONConfig cfg)
Set the JSONConfig for this object.
|
String |
JsonObject.toJSON(JSONConfig jsonConfig)
Return the JSON encoding of this object using the given configuration
options.
|
String |
JSONAble.toJSON(JSONConfig jsonConfig)
Convert this object to a string of JSON data.
|
void |
JsonObject.toJSON(JSONConfig jsonConfig,
Writer json)
Write the JSON encoding of this object to the given
Writer using
the given configuration options. |
void |
JSONAble.toJSON(JSONConfig jsonConfig,
Writer json)
Write this object to the given writer as JSON data.
|
static String |
JSONUtil.toJSON(Object obj,
JSONConfig cfg)
Convert an object to JSON and return it as a
String. |
static void |
JSONUtil.toJSON(Object obj,
JSONConfig cfg,
Writer json)
Convert an object to JSON and write it to the given
Writer. |
| Constructor and Description |
|---|
JsonObject(int size,
JSONConfig cfg)
Create a fixed size JsonObject backed by an array.
|
JsonObject(JSONConfig cfg)
Create a dynamically sized JsonObject backed by an
ArrayList. |
Copyright © 2016. All rights reserved.