JSON Model-to-Model Projection (JM2MP) Documentation

JSON Model-to-Model Projection (JM2MP) Documentation

Module

jm2mp/adapters/jsonpath

This module implements the QueryAdapter interface to use the JSONPath query language as part of JM2MP projection documents.

This module only supports jsonpath-plus 10.x versions. Other versions must be tested previously to be considered as well.

By compliance with JM2MP, the QueryAdapter created by createJsonataAdapter maintains the expected behaviour:

  • undefined, null and empty arrays --> null.
  • null input --> null output without calling [JSONPath+external:JSONPath external library.
  • Array with just one item --> Unwrap to single result.
  • Array with several items --> array (as-is).
  • Invalid expression during validation --> ValidationError.
  • Invalid expression during runtime --> EvaluationError.

The jsonpath-plus library is dynamically loaded when constructing its corresponding QueryAdapter. If not previously installed, an AdapterError exception will be raised from createJsonPathAdapter with a clear message about it.

Source

Methods