JSON Path

Content Type: Module
Categories: Import/Export

Overview

JSONPath = XPath for JSON A JSONPath implementation based on Jayway JsonPath java library (https://github.com/json-path/JsonPath).

Documentation

JSON-Path-module

Description

A JSONPath implementation based on the Jayway JsonPath java library (https://github.com/json-path/JsonPath).

Typical usage scenario

When JSON structures are nested it is not always convenient to use import mappings, because each level of nesting means that unnecessary entities and associations need to be added to the domain model. This module contains java actions for retrieving single values from a json structure as well as nested json objects and arrays that can be used in a import mappings.

  • Retrieving / Finding simple values from a (nested) JSON structure.
    • Strings, Integers, Decimals, Booleans
  • Retrieving JSON structures in a nested JSON structure
    • JSON Objects & Arrays (returned as Strings)
  • Using the JSONPath Syntax for filter results (e.g. filtering json before applying a import mapping)
    • Features and limitations

Available Microflow actions:

GetStringFromJSONByPath

  • Returns first String value from a JSON input matching JSONPath expression
  • Returns empty if not found or result is not String

GetBooleanFromJSONByPath

  • Returns first Boolean* value from a JSON input matching JSONPath expression
  • Returns empty if not found or result is not Boolean

GetIntegerFromJSONByPath

  • Returns first Integer value from a JSON input matching JSONPath expression
  • Returns empty if not found or result is not Integer/Long

GetDecimalFromJSONByPath

  • Returns first Decimal value from a JSON input matching JSONPath expression
  • Returns empty if not found or result is not numeric (Integer, Decimal, etc.)

GetJSONObjectFromJSONByPath

  • Returns JSON Object String from a JSON input matching JSONPath expression
  • Returns empty if not found or result is not a JSON Object

GetJSONArrayFromJSONByPath

  • Returns JSON Array String from a JSON input matching JSONPath expression
  • Returns empty if not found or result is not a JSON Array

*Does not actually return a Boolean, but an enumeration with _true & _ false values as Mendix does not support empty booleans

Resources

JSON Path Online Evaluator (for testing JSON Path expressions) http://jsonpath.com JSONPath Java Library Github https://github.com/json-path/JsonPath

Upgrading from versions < 2.3.0 to versions >= 2.3.0

Starting with version 2.3.0 the module has been migrated to Mendix 10 LTS and uses Mendix Managed Dependencies instead of Maven for its Java dependencies.

Therefore, after upgrading to version 2.3.0 or higher, you should remove any old .JSONPath-2.X.X.RequiredLib or JSONPath.RequiredLib files from your project as well as the corresponding .jar files from your userlib folder. Be aware that you may have other modules in your project that also depend on the same or different versions of the same dependencies, so make sure to check for that as well.

You can also remove any .pom files related to this module from your Resources folder that were used to manage the dependencies via Maven.

Developer Notes

Before publishing a new version of the module, increase the version numbers in the Mendix module.

 

 

 

 

Releases

Version: 2.3.0
Framework Version: 10.24.9
Release Notes:

- upgraded to Mendix LTS (10.24.9)

- upgraded Java version to 21

- migrated to Mendix Managed Dependencies:

https://docs.mendix.com/refguide/managed-dependencies/

Please have a look at the documenation for additional cleanup steps when upgrading from versions <2.3.0 of this module.

Version: 2.2.0
Framework Version: 9.24.30
Release Notes: * upgraded JSON Smart library to 2.5.1 to fix CVE-2024-57699 * upgraded to Mendix 9.24.30
Version: 2.1.0
Framework Version: 9.24.24
Release Notes: * upgraded Mendix version to 9.24.24 LTS
Version: 2.0.3
Framework Version: 8.18.30
Release Notes: * upgraded JSON Path library to 2.9.0 to fix security vulnerability * upgraded JSON Smart library to 2.5.1
Version: 2.0.2
Framework Version: 8.18.6
Release Notes: - patched JSON smart to 2.4.10 to fix vulnerability
Version: 2.0.1
Framework Version: 8.18.6
Release Notes: - re-release of v2.0.0
Version: 2.0.0
Framework Version: 8.18.6
Release Notes: - Upgraded to Mendix 8.18.6 - Updated Java dependencies & cleaned up unnecessary dependencies - Included a Maven file for better dependency management - Replaced Mendix project in the Git repository and added JSON path evaluator UI
Version: 1.1.0
Framework Version: 7.23.7
Release Notes: Fixed long parsing issue
Version: 1.0.1
Framework Version: 7.23.7
Release Notes: Upgraded to 7.23.7
Version: 1.0.0
Framework Version: 7.13.1
Release Notes: Initial Release