Version: 17.07
Supported Since: 17.07
A JSON Field Renamer is a processing element which renames a field, specified by the key
at a given JSON path
,
with a new key name.
In order to use this processing element, you must first select the JSON Operations dependency from the processors list when you are creating an empty Ultra project. If you have already created a project, you can add this dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Processors list, select the JSON Operations dependency. |
Next |
The resulting message context will be sent to this outport after renaming the specified field with a new key name at
the provided |
On Exception |
The message context will be sent to this outport if any exception occurred while renaming the specified field at the
provided |
JSON Path |
|
Current Key Name |
Name of the current key which is to be renamed at the specified |
New Key |
Key name to be assigned to the field. |
In the following use case, the requirement is to receive a message with JSON payload from an
HTTP NIO Ingress Connector,
rename the specified key
with a new key
name provided at a given JSON path
of the received message payload and
deliver the message to a backend service via an
HTTP NIO Egress Connector.
The challenge is to rename the specified key
at the given JSON path
of the message payload with the new key
name
provided.
In this flow a JSON Field Renamer processing element is configured to rename the sample key telephone-numbers
at the JSON path $
of the input JSON payload with the new key name numbers
.
For the following sample input JSON payload, the field telephone-numbers
will be renamed to numbers
.
{
"first-name": "John",
"last-name" : "Doe",
"age" : 24,
"address" : {
"streetAddress": "1st Cross Street",
"city" : "Colombo",
"postalCode" : "81000"
},
"telephone-numbers": [
{
"type" : "mobile",
"number": "074-234-567-890"
},
{
"type" : "land line",
"number": "011-234-567-890"
}
]
}
Final result will be as follows,
{
"first-name": "John",
"last-name" : "Doe",
"age" : 24,
"address" : {
"streetAddress": "1st Cross Street",
"city" : "Colombo",
"postalCode" : "81000"
},
"numbers": [
{
"type" : "mobile",
"number": "074-234-567-890"
},
{
"type" : "land line",
"number": "011-234-567-890"
}
]
}