Class Json5R
java.lang.Object
org.apache.juneau.marshall.marshaller.Marshaller
org.apache.juneau.marshall.marshaller.CharMarshaller
org.apache.juneau.marshall.marshaller.Json5
org.apache.juneau.marshall.marshaller.Json5R
A
Json5 variant that produces readable (indented, multi-line) JSON5 output.
This is the first-class facade form of the readable JSON5 variant. It pairs
Json5Serializer.DEFAULT_READABLE with Json5Parser.DEFAULT and exposes the full
static shortcut surface bound to its own DEFAULT instance.
Examples:
Notes:
- Because Java hides (does not override) static members, this class redeclares the
entire static shortcut surface of
Json5so that every shortcut is bound to this class's readableDEFAULTrather than the compactJson5.DEFAULT.
See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringSerializes a POJO to aString using theDEFAULTmarshaller.static voidstatic RecordWriterofArrayRecords(Object output) Opens aRecordWriterthat wraps each written value as one element of a top-level wire array using theDEFAULTmarshaller.static RecordWriterOpens a low-levelRecordWritercursor over the specified output using theDEFAULTmarshaller.static TokenWriterOpens a low-levelTokenWritergenerator over the specified output using theDEFAULTmarshaller.static <T> Tstatic <T> Tstatic <T> TParses an input into the specified object type using theDEFAULTmarshaller.static <T> TParses an input into the specified parameterized object type using theDEFAULTmarshaller.static RecordReadertoArrayRecords(Object input) Opens aRecordReaderthat yields each element of a top-level wire array using theDEFAULTmarshaller.static RecordReaderOpens a low-levelRecordReadercursor over the specified input using theDEFAULTmarshaller.static TokenReaderOpens a low-levelTokenReadercursor over the specified input using theDEFAULTmarshaller.Methods inherited from class org.apache.juneau.marshall.marshaller.CharMarshaller
read, read, writeMethods inherited from class org.apache.juneau.marshall.marshaller.Marshaller
getParser, getSerializer, read, read, readArrayRecords, readRecords, readTokens, write, writeArrayRecords, writeRecords, writeTokens
-
Field Details
-
DEFAULT
Default reusable instance, readable format.
-
-
Constructor Details
-
Json5R
public Json5R()Constructor.Uses
Json5Serializer.DEFAULT_READABLEandJson5Parser.DEFAULT.
-
-
Method Details
-
of
Serializes a POJO to aString using theDEFAULTmarshaller.- Parameters:
object- The object to serialize.- Returns:
- The serialized object.
- Throws:
SerializeException- If a problem occurred trying to convert the output.
-
to
Parses an input into the specified object type using theDEFAULTmarshaller.- Type Parameters:
T- The class type of the object being created.- Parameters:
input- The input.type- The object type to create.- Returns:
- The parsed object.
- Throws:
ParseException- Malformed input encountered.
-
to
Parses an input into the specified parameterized object type using theDEFAULTmarshaller.- Type Parameters:
T- The class type of the object to create.- Parameters:
input- The input.type- The object type to create.args- The type arguments of the class if it's a collection or map.- Returns:
- The parsed object.
- Throws:
ParseException- Malformed input encountered.
-
to
Parses the contents of aReaderinto the specified object type using theDEFAULTmarshaller.Catches any
IOExceptionfrom the underlying stream and rethrows it as an uncheckedParseException.- Type Parameters:
T- The class type of the object being created.- Parameters:
input- The input reader.type- The object type to create.- Returns:
- The parsed object.
- Throws:
ParseException- Malformed input encountered or an I/O error occurred on the underlying stream.
-
to
Parses the contents of aReaderinto the specified parameterized object type using theDEFAULTmarshaller.Catches any
IOExceptionfrom the underlying stream and rethrows it as an uncheckedParseException.- Type Parameters:
T- The class type of the object to create.- Parameters:
input- The input reader.type- The object type to create.args- The type arguments of the class if it's a collection or map.- Returns:
- The parsed object.
- Throws:
ParseException- Malformed input encountered or an I/O error occurred on the underlying stream.
-
of
Serializes a POJO to the specifiedWriterusing theDEFAULTmarshaller.Catches any
IOExceptionfrom the underlying stream and rethrows it as an uncheckedSerializeException.- Parameters:
object- The object to serialize.output- The writer to serialize to.- Throws:
SerializeException- If a problem occurred trying to convert the output or an I/O error occurred on the underlying stream.
-
toTokens
Opens a low-levelTokenReadercursor over the specified input using theDEFAULTmarshaller.- Parameters:
input- The input.- Returns:
- A new
TokenReader. - Throws:
IOException- If a problem occurred opening the underlying input.
-
ofTokens
Opens a low-levelTokenWritergenerator over the specified output using theDEFAULTmarshaller.- Parameters:
output- The output.- Returns:
- A new
TokenWriter. - Throws:
IOException- If a problem occurred opening the underlying output.
-
toRecords
Opens a low-levelRecordReadercursor over the specified input using theDEFAULTmarshaller.- Parameters:
input- The input.- Returns:
- A new
RecordReader. - Throws:
IOException- If a problem occurred opening the underlying input.
-
ofRecords
Opens a low-levelRecordWritercursor over the specified output using theDEFAULTmarshaller.- Parameters:
output- The output.- Returns:
- A new
RecordWriter. - Throws:
IOException- If a problem occurred opening the underlying output.
-
toArrayRecords
Opens aRecordReaderthat yields each element of a top-level wire array using theDEFAULTmarshaller.- Parameters:
input- The input.- Returns:
- A new
RecordReader. - Throws:
IOException- If a problem occurred opening the underlying input.
-
ofArrayRecords
Opens aRecordWriterthat wraps each written value as one element of a top-level wire array using theDEFAULTmarshaller.- Parameters:
output- The output.- Returns:
- A new
RecordWriter. - Throws:
IOException- If a problem occurred opening the underlying output.
-