Skip to main content
Version: Next

Map Json To Cloud Objects

Map JSON data to a CloudObject array

Description

Maps JSON data to a CloudObject array.
The brick will return the values for the keys in the provided JSON that match to the props in the Data Type you provide.
You can use the brick with "Auto Mapping" set to TRUE, so the brick will output only the values which exactly match the keys in the JSON to the props in the data type. OR
You can set up the "Mapper Config" for mapping configuration to act as a 'converter', so the JSON keys that do not match to any of your Data Type's properties names can be used.
If the configuration defines at least one property as a key, then this action will use caching to avoid creating multiple times the same object.

Configuring the Mapper

  1. Create a Config Data Type and drag and drop the Mapper Config to its "Inheritance" area
  2. Create an instance of this Config Data Type
  3. Set up the Map JSON To Objects input as follows:
    <ol>
  • Provide the JSON
  • Set the Object type to your destination data type
  • Set the Mapper Config with the name of the Config Data type in which you placed the Mapper Config inheritance
  • OPTIONAL: Set 'false' on the Auto Mapping input if you want only the MAPPER CONFIG values to be taken from the JSON </ol>

Inputs

  • Control Flow (Control Flow)
  • json (Object): JSON data. Can be in the form of string, object, array
  • data type (Type): Output object type, i.e. the data type
  • mapper config (Type): Mapping configuration
  • auto mapping (Boolean): If true, properties that are not defined in the config will be auto-mapped 1-to-1
  • unique (Boolean): If true, remove objects with the same tag in the output list
  • persist (Boolean): Indicates if the instance should be persisted, default: false

Outputs

  • Control Flow (Control Flow)
  • cloud objects (Array): Array of CloudObject