I will receive input values with two combinations either numeric or string value. If input is number you need to map it to one output field and if the input is string map to other field.
Eg, Input:
[{
"Input": "ABC123"
},
{
"Input": "12345"
}]
Output:
[{
"String": "ABC123"
},
{
"Number": "12345"
}]
2
Answers
You can use the json filter to determine the type since it will wrap a string in quotes, but not numbers. Check for the ” character and you’ll know if it’s a number. Will also cover your edge case.
Dotliquid does not have this functionality at this moment. It is open source project and you can download source code and change/Add new method in StandardFilters.cs. You can then use it for fulfil your requirement. you can add as many operation you like for your custom requirement.
e.g
Add below method in StandardFilters.cs
you can use this method in your liquid template like,