This process allows you to join two or more values from JSON key/value pairs and add the resulting value, with a name of your choice, into JSON records.
If this process is deployed then all JSON key names will be sorted into strict ascending Unicode character order. In general, this means numbers sort lowest followed by upper case letters which sort before lower case letters. New JSON key/value pairs are inserted into the re-ordered list of key/value pairs in the appropriate place.
When ProcessType is set to JsonPropertyConcatenator, a parent field named JsonPropertyConcatenatorConfiguration must be populated with sets of fields as shown below. You may have any number of Name and Value pairs as you wish. If you do not enter sufficient properties to allow the process to function, the process will be invalid and the pipeline will not start.
|
{
"Name": "D_PropertyConcatenator",
"Id": "3632e729-6efd-460b-9385-567824482fb6",
"JsonPropertyConcatenatorConfiguration": {
"PropertiesToConcatenate": ["job_name","job_id"],
"NameOfPropertyContainingResult": "JobNameJobId",
"Delimiter": "|"
},
"ProcessType": "JsonPropertyConcatenator"
}
Here we are looking for a JSON key names of job_name
and job_id
and when both are found, creating a new JSON key of JobNameJobId. The value of the item will be a concatenation of the job_name
and job_id
fields, separated by the specified delimiter character. All values going into a concatenation are treated as strings and the output value is enclosed in double quotes to denote it is a string.
{ "job_name":"fred", "job_type":"batch", "user":"PRODPAY", "job_id":11738 }
{ "JobNameJobId":"fred|11738", "job_id":11738, "job_name":"fred",
"job_type":"batch", "user":"PRODPAY" }
If any of the JSON key names listed in PropertiesToConcatenate are missing in a JSON record, the record will pass unaltered through this process.
If any of the values of the JSON key names listed in PropertiesToConcatenate are missing, a JSON record will have it's field re-ordered as described above and the key named in NameOfPropertyContainingResult will be added in the correct place to maintain the key name sort order. Delimiters will still be used to separate the component parts of the output key, treating the missing values as "null strings", including if necessary having a delimiter as the first or last character of the value for the new key.
Example:
Using the sample configuration above and this sample record (note that the job_id key/value pair is not present):
{ "job_name":"fred", "job_type":"batch", "user":"PRODPAY" }
{ "JobNameJobId":"fred|", "job_name":"fred", "job_type":"batch",
"user":"PRODPAY" }