Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have a file which contains JSON data. Using tFileInputJson component to extract data from it and some of the fields are surrounded by [ ] and double quotes. What is the best method to remove surrounding characters?
Output:
InputFile:
{
"Options": [
{
"Value": 111111,
"Color": "#0000ff",
"IsManaged": false,
"ExternalValue": "",
"ParentValues": [],
"MetadataId": null,
"HasChanged": null,
"Label": {
"LocalizedLabels": [
{
"Label": "United States",
"LanguageCode": 1033
}
]
},
"Description": {
"LocalizedLabels": [
{
"Label": "TestDescription1"
}
]
}
},
{
"Value": 222222,
"Color": "#0000ff",
"IsManaged": false,
"ExternalValue": "",
"ParentValues": [],
"MetadataId": null,
"HasChanged": null,
"Label": {
"LocalizedLabels": [
{
"Label": "Canada",
"LanguageCode": 1033
}
]
},
"Description": {
"LocalizedLabels": [
{
"Label": "TestDescription2"
}
]
}
}
]
}
I think this might be because you have a wildcard in your JSONPath for the arrays. If you change the * to a 0 in [] for your values, this should remove the brackets. Of course, it will only return the first instance of the array.