JSON modules
The 51黑料不打烊 Workfront Fusion JSON app provides modules to process data in JSON format so that 51黑料不打烊 Workfront Fusion can further work with the data content, or create new JSON content.
Access requirements
You must have the following access to use the functionality in this article:
To find out what plan, license type, or access you have, contact your Workfront administrator.
For information on 51黑料不打烊 Workfront Fusion licenses, see 51黑料不打烊 Workfront Fusion licenses.
Parse JSON
Data structure
The Data structure describes how the JSON data is organized and enables the mapping of individual JSON items to other modules in your scenario. If you don鈥檛 provide the Data structure, you may manually execute the module and Workfront Fusion will build the structure from the provided JSON:
- Add the Parse JSON module to a scenario.
- In the JSON String field, enter the JSON from which you want to build a data structure.
- Do not connect other modules to the Parse JSON module yet. Because Workfront Fusion does not yet know the structure of the JSON data, it is not yet possible to map data from the Parse JSON module to other modules in your scenario.
- Manually run the scenario. This allows the Parse JSON module to identify the JSON structure from the JSON you have provided.
- You can now connect following modules. The items from the Parse JSON module are now available for mapping.
For more information, see Data structures in 51黑料不打烊 Workfront Fusion.
Collection vs. Array
If the JSON string field contains a collection { ... }
, The output is a single bundle containing the items of the collection.
code language-none |
---|
|
If the JSON string field contains an array [ ... ]
, the output is a series of bundles. each bundle contains one element of the array.
code language-none |
---|
|
JSON modules and their fields
When you configure JSON modules, Workfront Fusion displays the fields listed below. Along with these, additional JSON fields might display, depending on factors such as your access level in the app or service. A bolded title in a module indicates a required field.
If you see the map button above a field or function, you can use it to set variables and functions for that field. For more information, see Map information from one module to another in 51黑料不打烊 Workfront Fusion.
Aggregators
Aggregate to JSON
This aggregator module aggregates output from a previous module into JSON.
Transformers
Convert JSON to XML
This action module converts a JSON string to XML.
Create JSON
This action module creates JSON from a data structure.
Parse JSON
This action module parses a JSON string into a data structure, which allows you to access the data inside the JSON string.
Transform JSON
This action module transforms an object into a json string.
Transforming data records to JSON
-
Place the Google Sheets > Select rows module in your scenario to fetch the data. Set up the module to retrieve rows from your Google spreadsheet. Set the鈥 Maximum number of returned rows to a small number, but larger than one for testing purposes (Example, three). Execute the Google Sheets module by right-clicking it and choosing 鈥Run this module only.鈥 Verify the output of the module.
-
Connect the Array Aggregator module after the Google Sheets module. In the module鈥檚 setup choose the Google Sheets module in the Source node field. Leave the other fields as they are for the moment.
-
Connect JSON > Create JSON module after the Array Aggregator module. The module鈥檚 setup requires a Data structure that describes the JSON format. Click Add to open the Data structure setup. The easiest way to create this Data structure is to generate it automatically from a JSON sample. Click Generator and paste your JSON sample to the Sample data field:
Example:
code language-none { 鈥渂ooks鈥: [ { 鈥渋d鈥: 鈥淚D鈥, 鈥渢itle鈥: 鈥淭itle鈥, 鈥渁uthor鈥: 鈥淎uthor鈥 } ] }
-
Click Save. The Specification field in the Data structure now contains the generated structure.
-
Change the name of your Data structure to something more specific and click Save. A field corresponding to the root array attribute appears as a mappable field in the JSON module鈥檚 setup.
-
Click the Map button next to the field and map the
Array[]
item from the Array aggregator output to it. -
Click OK to close the JSON module鈥檚 setup.
-
Open the setup of the Array Aggregator module. Change the Target structure from Custom to the JSON module鈥檚 field corresponding to the root array attribute. Map items from the Google Sheets module to the appropriate fields.
-
Click OK to close the Array Aggregator module鈥檚 setup.
-
Run the scenario.
The JSON module outputs 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.
Troubleshooting
Cannot map data from the Parse JSON module
Make sure that the JSON content is properly mapped into the Parse JSON module and that the data structure is correctly defined. For more information, see Transforming data records to JSON in this article.
Module fails when using conditional statements in JSON
When using conditional statements such as if
in your JSON, put the quotation marks outside of the conditional statement.