JSON

With the JSON app in Make, you can process data or create new content in JSON format.
You do not need to establish a connection to use the JSON app.
JSON modules
You can use the following modules to build your scenarios.
Aggregators
Aggregate to JSON
Converts the multiple output bundles to a single bundle.
You need to attach this aggregator module to the source module whose output you want to convert to a single module; for example, the Parse JSON modules give the output in multiple bundles.
After selecting the source module, select the data structure, and the remaining fields are populated from the source module.

Save the scenario and run it. The output is only one bundle.

Transformers
Convert JSON to XML
Converts the given JSON data to XML format.

Create JSON
This module helps you create JSON. The fields in this module depends on your data structure.
The data structure describes how the JSON data is organized and enables mapping individual JSON items to other modules in your scenario.

Select the data structure and enter the field details to create JSON. The data provided in the module returns in the JSON format in the output.

Parse JSON
Data structure
The data structure describes how the JSON data is organized and enables mapping individual JSON items to other modules in your scenario. If you don't provide the Data structure, you may manually run the module and Make will build the structure from the provided JSON:
Fill the JSON string field in the Parse JSON module.
Do not yet connect the modules that follow. Since Make doesn't know the structure of the JSON data, it will not be possible to map data from the Parse JSON module to other modules in your scenario.
Manually run the scenario. The Parse JSON module will identify the JSON structure from your provided JSON.
You can now connect the modules that follow. The items from the Parse JSON module will now be available for mapping.
Collection vs. Array
JSON string field can contain a collection.
{ ... }
{ "name" : "Peter", "ID" : 1}In which case, the output will be a single bundle containing the items of the collection:
Or it can contain an array.
[ ... ]
:
[ { "name" : "Peter", "ID" : 1 }, { "name" : "Mike", "ID" : 2 }]In which case the output will be a series of bundles, each bundle containing one array's item.
Transform to JSON
Transforms any object to JSON.
Let us assume that the data records you wish to transform to JSON format are in a Google spreadsheet. Here is the procedure on how to transform the data records to JSON format:
Place the Google Sheets > Select rows module in your scenario to get the data. Set up the module to retrieve rows from your Google spreadsheet and set the Maximum number of returned rows to a small number but larger than one for testing purposes (e.g., three). Run the Google Sheets module (right-click it and choose "Run this module only") and verify its output.
Connect the Array Aggregator module after the Google Sheets module. In the module's setup, choose the Google Sheets module in the Source node field. Leave the other fields as they are for the moment.
Connect the JSON > Create JSON module after the Array Aggregator module. The module's setup requires a data structure that describes the JSON format. Click the Add button to open the Data structure setup. The easiest way to create this Data structure is to generate it automatically from a JSON sample. Click the Generator button and paste your JSON sample to the Sample data field:
{ "books": [ { "id": "ID", "title": "Title", "author": "Author" } ]}
Click Save. The Specification field in the Data structure setup should now contain the generated structure.
Change the name of your Data structure to something more specific (e.g., "Books") and click Save. A field corresponding to the root array attribute should appear mappable in the JSON module's setup.
Click the Map button next to the field and map the Array[] item output from the Array aggregator module.

Click OK to close the JSON module's setup.
Open the setup of the Array Aggregator module. Change the Target structure from Custom to the JSON module's field corresponding to the root array attribute. Map items output from the Google Sheets module to the appropriate fields.

Click OK to close the Array Aggregator module's setup.
Run the scenario. The JSON module should output the correct JSON format. Open the setup of the Google Sheets module and increase the Maximum number of returned rows number to be larger than the number of rows in your spreadsheet to process all the data. The resulting JSON can then be used as a body of an HTTP request, returned as a Webhook's response, etc.




