I have a flat file which contains information such as names, addresses, mobile numbers, email addresses, etc. We want to convert this into a JSON-structured output. I have created a data flow which is producing the below output (this is not valid json)
Flow:-
Logic:-
‘{
“Name”: “Test Customer 1”,
“Id”: 2,
“to_AddressIndependentMobile”: [
{
“result”: {
“MobilePhoneNumber”: “010-1100-111”
}
}
]
}
‘
However I need slight changes in output like below
‘{
“Name”: “Test Famouns London Imaging Center”,
“Id”: 2,
“to_AddressIndependentMobile”: {
“results”: [
{
“Contact”: “010-1100-111”
}
]
}
}’
Need help on this.
Expected Output
2
You can use the below expression to the to_AddressIndependentMobile
column in the derived column to achieve your requirement.
@(results=[@(contact=contact)])
You can see it’s giving the expected JSON structure. You can remove extra contact
column using select transformation after this.
Result in JSON file:
5