Package org.apache.synapse.commons.staxon.core.json.jaxb

# Annotation Type JsonXML

@Documented @Retention(RUNTIME) @Target({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

- 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 Elements
  Modifier and Type
  Optional Element
  Description
  `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.

- ## Element Details

  - ### virtualRoot

    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

    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

    boolean prettyPrint

    Format output for better readability?

    The default value is `false`.

    Default:
      `false`

  - ### autoArray

    boolean autoArray

    Trigger arrays automatically?

    The default value is `false`.

    Default:
      `false`

  - ### autoPrimitive

    boolean autoPrimitive

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

    The default value is `false`.

    Default:
      `false`

  - ### namespaceDeclarations

    boolean namespaceDeclarations

    Whether to write namespace declarations.

    The default value is `true`.

    Default:
      `true`

  - ### namespaceSeparator

    char namespaceSeparator

    Namespace prefix separator.

    The default value is `':'`.

    Default:
      `':'`