Package org.apache.juneau.marshall.json5
Class Json5Parser
- All Implemented Interfaces:
JsonMetaProvider,ArrayRecordReadable,RecordReadable,TokenReadable
- Direct Known Subclasses:
Json5lParser
Parses any valid JSON text into a POJO model.
Content-Type types: application/json5, text/json5
application/json5 . Use this parser when the input may
contain JSON5-style syntax.
Media types
HandlesDescription
Identical toJsonParser but accepts JSON5 syntax (single quotes, comments, trailing commas,
unquoted keys) and uses media type Example input (Map of name/age):
{name:
Complex (nested object + array):
{name:
Notes:
- This class is thread safe and reusable.
See Also:
- JSON
JsonParser- For strict RFC 8259 JSON only
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.juneau.marshall.parser.ReaderParser
ReaderParser.DefaultBuilderNested classes/interfaces inherited from class org.apache.juneau.marshall.parser.Parser
Parser.Null -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Json5ParserDefault parser, Accept=application/json5.Fields inherited from class org.apache.juneau.marshall.json.JsonParser
validateEndFields inherited from class org.apache.juneau.marshall.parser.Parser
autoCloseStreams, consumes, debugOutputLines, listener, nulls, trimStrings, unbufferedFields inherited from class org.apache.juneau.marshall.MarshallingContextable
marshallingContextFields inherited from class org.apache.juneau.marshall.Context
CONTEXT_APPLY_FILTER -
Constructor Summary
ConstructorsConstructorDescriptionJson5Parser(JsonParser.Builder<?> builder) Constructor.Json5Parser(Json5Parser.Builder builder) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a builder from this context object.static Json5Parser.Buildercreate()Creates a new builder for this object.Create a session builder based on the properties defined on this context.Returns a session to use for this context.Methods inherited from class org.apache.juneau.marshall.json.JsonParser
getJsonBeanPropertyMeta, getJsonClassMeta, isValidateEnd, readArrayRecords, readTokensMethods inherited from class org.apache.juneau.marshall.parser.ReaderParser
getStreamCharset, isReaderParser, propertiesMethods inherited from class org.apache.juneau.marshall.parser.Parser
canHandle, createParserBuilder, doRead, getDebugOutputLines, getListener, getMediaTypes, getNulls, getPrimaryMediaType, isAutoCloseStreams, isTrimStrings, isUnbuffered, read, read, read, read, read, read, readArgs, readIntoCollection, readIntoMap, readWithOuterMethods inherited from class org.apache.juneau.marshall.MarshallingContextable
getDurationFormat, getMarshallingContext, getPeriodFormatMethods inherited from class org.apache.juneau.marshall.Context
createBuilder, getAnnotationProvider, init, isDebug, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.juneau.marshall.stream.ArrayRecordReadable
isArrayRecordStreaming, readArrayRecordsMethods inherited from interface org.apache.juneau.marshall.stream.RecordReadable
isRecordStreamingMethods inherited from interface org.apache.juneau.marshall.stream.TokenReadable
readRecords
-
Field Details
-
DEFAULT
Default parser, Accept=application/json5.
-
-
Constructor Details
-
Json5Parser
Constructor.- Parameters:
builder- The builder for this object.
-
Json5Parser
Constructor.- Parameters:
builder- The builder for this object.
-
-
Method Details
-
create
Creates a new builder for this object.- Returns:
- A new builder.
-
copy
Description copied from class:ContextCreates a builder from this context object.Builders are used to define new contexts (e.g. serializers, parsers) based on existing configurations.
- Overrides:
copyin classJsonParser- Returns:
- A new Builder object.
-
createSession
Description copied from class:ContextCreate a session builder based on the properties defined on this context.Use this method for creating sessions where you want to override basic settings. Otherwise, use
Context.getSession()directly.- Overrides:
createSessionin classJsonParser- Returns:
- A new session builder.
-
getSession
Description copied from class:ContextReturns a session to use for this context.Note that subclasses may opt to return a reusable non-modifiable session.
- Overrides:
getSessionin classJsonParser- Returns:
- A new session object.
-