java.lang.Object
com.pervasive.datarush.json.JSON
The primary class that should be used for performing any JSON
serialization/deserialization. This class is built on top of Jackson's
ObjectMapper and thus honors standard Jackson annotations to
control serialization/deserialization. In addition, this class searches for
types registered via TypeResolutionProvider.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFormats the object as JSON<T> TParses the given reader as a JSON object of the given type<T> TParses the given string as a JSON object of the given typeprettyPrint(Object obj) Pretty-prints the object as JSONvoidRelax the JSON standard while parsing.
-
Constructor Details
-
JSON
public JSON()Create a new JSON instance.
-
-
Method Details
-
relaxStandard
public void relaxStandard()Relax the JSON standard while parsing. Allow unquoted field names and single quotes around values. -
parse
Parses the given reader as a JSON object of the given type- Type Parameters:
T- the type to parse as- Parameters:
src- the readerasClass- the type to parse as- Returns:
- an object of the requested type
-
parse
Parses the given string as a JSON object of the given type- Type Parameters:
T- the type to parse as- Parameters:
json- the stringasClass- the type to parse as- Returns:
- an object of the requested type
-
format
Formats the object as JSON- Parameters:
obj- the object to format- Returns:
- the object, formatted as JSON
-
prettyPrint
Pretty-prints the object as JSON- Parameters:
obj- the object to format- Returns:
- the object, formatted as JSON
-