- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
- Loop for json records.
- Fetch a record of json data.
3 Append a new line / line feed / carriage return (and this should be visible in the RAW data preview too) - Fetch another record of json data
- Insert this new record on a new line
- Store the updated file as .json
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 01:28 PM
Not the most efficient, but update the expression in the Mapper snap to the following:
$content.replace(/\n/g, “,\n”).replace(/,\n$/, “”)
This will remove the comma and newline of the last record… if you want to keep the newline on the last line, use the following:
$content.replace(/\n/g, “,\n”).replace(/,\n$/, “\n”)
