โ07-16-2020 10:03 AM
Hello,
We are creating a data interface between snaplogic and reltio with a .json file.
Reltio expects the .json file to be in a specific format as below:
Notice the โnew lineโ i.e โ\nโ inserted after every record of json data.
We tried scripts hook, regular expression with replaceAllโฆetc but havenโt been successful.
Any help in this regard would be appreciated.
We intend to achieve the following:
Any quick help shall be highly appreciated.
{"uri":"entities/aaa","type":"configuration/entityTypes/HCP","attributes":{"Name":[{"value":"NAME_DDD"}],"FirstName":[{"value":"FIRST_GGG"}],"LastName":[{"value":"LAST_GGG"}],"MiddleName":[{"value":"VAN"}],"Employment":[{"value":{"Title":[{"value":"TITLE_GGG"},{"value":"TITLE_GGG"}],"Summary":[{"value":"SUMMARY_GGG"}]}}],"Address":[{"value":{"City":[{"value":"CITY_GGG"}]}}],"Identifiers":[{"value":{"Type":[{"value":"TYPE2"}],"ID":[{"value":"ID1"}]}}]},"crosswalks":[{"value":"CROSSWALK_aaa","sourceTable":"SOURCE_TABLE_GGG","type":"configuration/sources/LNKD"}]},
{"uri":"entities/bbb","type":"configuration/entityTypes/HCP","attributes":{"Name":[{"value":"NAME_HHH"}],"FirstName":[{"value":"FIRST_HHH"}],"LastName":[{"value":"LAST_HHH"}],"MiddleName":[{"value":"VAN"}],"Employment":[{"value":{"Title":[{"value":"TITLE_HHH"},{"value":"TITLE_HHH"}],"Summary":[{"value":"SUMMARY_HHH"}]}}],"Address":[{"value":{"City":[{"value":"CITY_HHH"}]}}],"Identifiers":[{"value":{"Type":[{"value":"TYPE2"}],"ID":[{"value":"ID1"}]}}]},"crosswalks":[{"value":"CROSSWALK_bbb","sourceTable":"SOURCE_TABLE_HHH","type":"configuration/sources/LNKD"}]}
Solved! Go to Solution.
โ07-16-2020 12:02 PM
Try this. Basically, it still uses the JSON Formatter with โJSON Linesโ but then added a Binary to Document with no conversion and a Mapper with Document input and Binary output views to replace the newline with comma-newline before writing back to file.
Example pipeline converting a CSV to the JSON format requested attached.
JSON_Lines_Create_File.zip (2.7 KB)
โ07-16-2020 10:43 AM
This sounds like you just need to use the JSON Formatter with โJSON Linesโ option checked.
โ07-16-2020 11:32 AM
Thank you @koryknick. I did use the โJSONLinesโ field, but the problem is that it doesnโt include a โ,โ (comma) after every json record. I need a way to append a comma, and a LINEFEED, so that the new jason record is written on the next line than just appending.
โ07-16-2020 12:02 PM
Try this. Basically, it still uses the JSON Formatter with โJSON Linesโ but then added a Binary to Document with no conversion and a Mapper with Document input and Binary output views to replace the newline with comma-newline before writing back to file.
Example pipeline converting a CSV to the JSON format requested attached.
JSON_Lines_Create_File.zip (2.7 KB)
โ07-16-2020 01:10 PM
Hi Kory,
Perfect! That was timely help.
Small issue, Its adding comma at the last line of the line also which is making in-valid json. Please suggest
Thanks,
Mithila JT