Transformer

Companion:
class
class Object
trait Matchable
class Any

Type members

Classlikes

A Transformer that converts certain DOM elements of a given DOM structure that are not supported by the JSON renderer into alternative elements that can be represented in JSON.

A Transformer that converts certain DOM elements of a given DOM structure that are not supported by the JSON renderer into alternative elements that can be represented in JSON.

The elements that are not supported (and as such will still trigger errors during an attempted encoding to JSON) are:

  • Non-String Map Keys
  • Float.NaN, Float.PositiveInfinity, Float.NegativeInfinity
  • Double.NaN, Double.PositiveInfinity, Double.NegativeInfinity
  • Tags

This transformer can be used, for example, for converting a CBOR document to JSON by first parsing the CBOR encoding into a Dom.Element, then applying this transformer and then encoding the transformation result to JSON.

NOTE: Since there is no single, standard way of representing the CBOR-only DOM elements in JSON this transformer provides merely one of many possible such implementations. Override the respective methods in order to customize the logic!