Annotation Type JsonXML
The JsonXML annotation is used to configure the JSON
serialization and deserialization process. It may be placed on a
- a model type (e.g. a JAXB-annotated class) to configure serialization and deserialization of that type,
- a JAX-RS resource method to configure serialization of the result type,
- a parameter of a JAX-RS resource method to configure deserialiation of the parameter type.
If an annotations is present at a model type and a resource method or parameter, the latter overrides the model type annotation.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanTrigger arrays automatically?booleanConvert element text to number/boolean/null primitives automatically?String[]Specify array paths.booleanWhether to write namespace declarations.charNamespace prefix separator.booleanFormat output for better readability?booleanJSON documents may have have multiple root properties.
-
Element Details
-
virtualRoot
boolean virtualRootJSON 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
@XmlRootElementor@XmlTypeannotation.The default value is
false(i.e. no virtual root).- Default:
false
-
multiplePaths
String[] multiplePathsSpecify 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 ifvirtualRootis set tofalse(i.e. the root does appear in the JSON representation).E.g. for
{ "alice" : { "bob" : [ "edgar", "charlie" ], "peter" : null } }with
virtualRoot == falsewe 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.- Default:
{}
-
prettyPrint
boolean prettyPrintFormat output for better readability?
The default value is
false.- Default:
false
-
autoArray
boolean autoArrayTrigger arrays automatically?
The default value is
false.- Default:
false
-
autoPrimitive
boolean autoPrimitiveConvert element text to number/boolean/null primitives automatically?
The default value is
false.- Default:
false
-
namespaceDeclarations
boolean namespaceDeclarationsWhether to write namespace declarations.
The default value is
true.- Default:
true
-
namespaceSeparator
char namespaceSeparatorNamespace prefix separator.
The default value is
':'.- Default:
':'
-