@Documented
@Retention(value=RUNTIME)
@Target(value={METHOD,TYPE,PARAMETER})
public @interface JsonXML
The JsonXML annotation is used to configure the JSON
serialization and deserialization process. It may be placed on a
If an annotations is present at a model type and a resource method or parameter, the latter overrides the model type annotation.
| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
autoArray
Trigger arrays automatically?
|
boolean |
autoPrimitive
Convert element text to number/boolean/null primitives automatically?
|
java.lang.String[] |
multiplePaths
Specify array paths.
|
boolean |
namespaceDeclarations
Whether to write namespace declarations.
|
char |
namespaceSeparator
Namespace prefix separator.
|
boolean |
prettyPrint
Format output for better readability?
|
boolean |
virtualRoot
JSON documents may have have multiple root properties.
|
public abstract boolean virtualRoot
JSON documents may have have multiple root properties. However,
XML requires a single root element. This property states whether to treat
the root as a "virtual" element, which will be removed from the stream
when writing and added to the stream when reading. The root element
name will be determined from an @XmlRootElement or
@XmlType annotation.
The default value is false (i.e. no virtual root).
public abstract java.lang.String[] multiplePaths
Specify array paths. Paths may be absolute or relative (without
leading '/'), where names are separated by '/'
and may be prefixed. The root element is included in a multiple path
if and only if virtualRoot is set to false
(i.e. the root does appear in the JSON representation).
E.g. for
{
"alice" : {
"bob" : [ "edgar", "charlie" ],
"peter" : null
}
}
with virtualRoot == false we would specify
"/alice/bob", "alice/bob" or "bob"
as multiple path.
On the other hand, when setting virtualRoot == true, our JSON
representation will change to
{
"bob" : [ "edgar", "charlie" ],
"peter" : null
}
and we would specify "/bob" or "bob" as multiple path.public abstract boolean prettyPrint
Format output for better readability?
The default value is false.
public abstract boolean autoArray
Trigger arrays automatically?
The default value is false.
public abstract boolean autoPrimitive
Convert element text to number/boolean/null primitives automatically?
The default value is false.
Copyright © 2005-2021 Apache Software Foundation. All Rights Reserved.