cancel
Showing results for 
Search instead for 
Did you mean: 

How to write GET request content to a file with new lines instead of \n characters

jmousavi
New Contributor

I am trying to get an expression library from the Github API and save the content into a file in Snaplogic. When I get the content from the GET snap, it has \n characters and doesn’t recognize them as actual new lines. I then use the Width Formatter snap in order to get Snaplogic to recognize the \n characters as new lines. However, once I pass this into the File Writer snap, the file that was saved has no new lines, and the entire expression library is on one line.

Do you know how I can get Snaplogic to save the file with the new lines, formatted correctly?

6 REPLIES 6

jmousavi
New Contributor

I am able to parse it, however it puts the keys in quotes and still doesn’t put any new lines in the file.
After running JSON.parse in the mapper, the output looks like this:
{
“object” : {
“source_1” : “website”,
“source_2”: “website”
}
}
After JSON formatter and file writer, the saved file looks like this:
{“object” : {“source_1” : “website”, “source_2”: “website” } }

Try checking the “Pretty Print” checkbox in the JSON Formatter. This should put the \n characters in.