One Star

JSON Output File with multiple fields

Hello,
I am using the tWriteJSONfield component to structure inbound rows into JSON syntax. This correctly structures my data rows like:
{
"office": {
"office_id": "1979",
"office_name": "AIR PRODUCTS",
"channel": [],
"address_line_1": "1775 EQUITY LANE",
"address_line_2": "PO BOX 1148",
"address_line_3": [],
"address_line_4": [],
"city": "TROY",
"state": "MI",
"zip_code": "48099-1155",
"country": "US",
"territories": {
"territory": {
"state_fips": "0",
"county_fips": "0"
}
}
}
}
My problem is that now I want all of my rows returned into a grouping element like "offices":{}. I have tried the following:
1. Using the tfileOutputJSON component after tWriteJSONfield. This will group my rows into a parent element, however each office element then has the quotes escaped like {\"office\":{\"office_id\":\"2231\",\"office_name\":
2. Changing my tWriteJSONField to include the "offices":{} grouping. This just adds "offices":{} to each output row without grouping
I see there are some new options in the 5.3 release that might be helpful, but I need to accomplish this in 5.1.2.
Any guidance is appreciated.
1 REPLY
Community Manager

Re: JSON Output File with multiple fields

Hi
What's the incoming data before tWriteJSONfield ? and What are your expected result? Do you just want to output only one row of json-string?
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business