JSON serialization of ruleset XOMs

Ruleset parameters of primitive Java™ types, arrays, and Java XOM classes can be serialized to JSON through a Jackson process.

Each ruleset parameter is written as a JSON name/value pair. If the default serialization does not provide the results that you expect for your classes, you can customize the serialization process by using Jackson or JAXB annotations. Jackson annotations are applied before JAXB annotations with matching precedence. Some JAXB annotations are not supported or do not have a JSON equivalent.

An empty constructor, either public or private, is needed to deserialize with Jackson.

Jackson version

Jackson currently exists as two major versions, 1.x and 2.x. Packaging and API differences make the two releases incompatible. The REST service for ruleset execution uses Jackson 2.x, which means that you must use Jackson 2.x to annotate the Java XOM classes.

Some known limitations

  • JSON serialization might create a memory leak and cause the application server to fail. By default, HTDS enables the problem cache to be cleared every 24 hours. Adjust this property to accommodate your application usage (see Managing memory consumption when you use the hosted transparent decision service).
  • Static nested classes are supported. Nonstatic nested classes, also known as inner classes, are not supported.
  • Cyclic links between three or more classes are not supported.
  • The official Jackson documentation recommends not to use java.sql.date. For more information, see the Jackson JSON Processor Wiki.
  • If you use Java primitive types as input values in your execution requests, make sure that each value falls within its corresponding data type range. Otherwise, you might get unexpected output.