JSON step
Last updated
Was this helpful?
Last updated
Was this helpful?
The example of data in JSON format:
This step is made for:
vice versa—composing JSON data from objects (usually, in order to send this piece of data to a third party system).
First and foremost, you need to setup JSON schema for parsing or composing. You can do it simply by copy-pasting example of your JSON-data into the field (the values may be any, only keys are matter).
After setting up the scheme you can choose what are you going to do: to parse or to compose JSON.
If the property is object, you will have two options for parsing.
You can fetch properties of object without creating new objects on Directual. Choose to current object
in a subselect.
You can map properties of object to the fields of a new object on Directual. Choose to other object
in a subselect. On the right side you choose field type of link, a new object will be created (or of you map property to id field and such an object exists, it will be edited accordingly).
If the property is a complex array (an array of objects), you will have two options for parsing.
If you choose to parse array property to objects, you will have to choose the destination field type of arrayLink. The step will create new objects and write array of IDs of these objects into the selected field.
In this option you configure mapping of child elements of the JSON array to child elements of arrayLink field.
You can pick one element from the JSON array and save it to a field type of JSON.
You can pick one element from the JSON array and save it to a new object. In order to do that choose field type of link on the right side. The step will create new object and write ID of this object into the selected field.
Note that here (only here) you can choose the fields of linked (like {{authorId.firstName}}
) objects and paste them to the composed JSON:
If the field (on the left side) has a type of link, the json property will be nested object& You setup mapping of fields of the elements from linked object and properties of nested object property (which were set up in JSON Schema).
If the field (on the left side) has a type of arrayLink, the json property will be array as well, with elements from this field. You setup mapping of fields of the elements from arrayLink and properties of array (which were set up in JSON Schema).
JSON () is a lightweight data format. JSON is the most popular data-interchange language—90% of all the APIs on the Internet interchange data in JSON format.
parsing JSON-data to (in order to process them);
You can also use to handle JSON data
First, you choose the field in object () where the step will get the JSON to parse.Then, you map json properties to the fields of the current object.
First, you choose the field in object () in which the composed JSON will be saved.Then, you map fields of the current object and json properties.