JSON functions

This page describes the additional set of predefined Jsonnet functions for the Data Transformer Script task available in Application Integration.

Before you begin

To use the following predefined functions, you must import the functions library in your script. Importing the functions library lets you use both the standard Jsonnet functions and the predefined Data Transformer functions.

Application Integration supports Jsonnet functions library v0.20.0. For information about the Jsonnet standard functions, see Jsonnet Standard Library.

Object Remove Key

Syntax
        
objectRemoveKey(obj, key)
      
Description Removes a property from a JSON object.
Input parameter obj: The input JSON object.

key: The JSON property to remove.

Return type JSON
Output Updated JSON object after removing the specified property and its corresponding value.

Parse CSV With Header

Syntax
        
parseCsvWithHeader(input, delimiter = ",", overwrite_duplicate_headers = true)
      
Description Parse given input csv string as json. The first row would be considered as header. For example, f.parseCsvWithHeader("index,product,company\n1,Application Integration,Google\n2,Pubsub,Google") would generate [{"index": "1", "product": "Application Integration", "company": "Google"},{"index": "2", "product": "Pubsub", "company": "Google"}].
Input parameter input: The CSV string to be parsed.

delimiter: Delimiter string to be used. Default value is ','.

overwrite_duplicate_headers: Option to overwrite values for the duplicate headers. If set to false, duplicate header would be renamed. Default value is true.

Return type JSON
Output Returns the json representation of given csv string.

Manifest CSV

Syntax
        
manifestCsv(json, headers = null)
      
Description Convert given json into csv string. For example, f.manifestCsv([{"index": "1", "product": "Application Integration", "company": "Google"},{"index": "2", "product": "Pubsub", "company": "Google"}]) would generate index,product,company\n1,Application Integration,Google\n2,Pubsub,Google.
Input parameter json: JSON to be converted into csv.

headers: Headers list for csv output. If no value is provided, it would use all the headers.

Return type STRING
Output Returns the csv string from json in given format.

Recommendation