de.odysseus.staxon.json.jaxb
Annotation Type JsonXML


@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.


Optional Element Summary
 boolean autoArray
          Trigger arrays automatically?
 boolean autoPrimitive
          Convert element text to number/boolean/null primitives automatically?
 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.
 

virtualRoot

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).

Default:
false

multiplePaths

public abstract 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.

Default:
{}

prettyPrint

public abstract boolean prettyPrint

Format output for better readability?

The default value is false.

Default:
false

autoArray

public abstract boolean autoArray

Trigger arrays automatically?

The default value is false.

Default:
false

autoPrimitive

public abstract boolean autoPrimitive

Convert element text to number/boolean/null primitives automatically?

The default value is false.

Default:
false

namespaceDeclarations

public abstract boolean namespaceDeclarations

Whether to write namespace declarations.

The default value is true.

Default:
true

namespaceSeparator

public abstract char namespaceSeparator

Namespace prefix separator.

The default value is ':'.

Default:
58


Copyright © 2011-2012. All Rights Reserved.