formatting issue

Document ID : KB000016629
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

When you write a property to a delimited file or CSV file and it adds additional quotes in the CSV file. This is the expected behavior. 

Question:

I captured a Json response in a  filter. When I write the filter value to a delimited file (CSV), for some reason when you look at the response in a text editor you are seeing additional quotes for the response.

 

For example a json response will look like:  

"{ 

""dob"": """", 

""streetAddress"": ""21 Street"", 

""city"": ""Piscataway"", 

""state"": ""NJ"", 

""zipCode"": ""08854"" 

}"

 

Environment:
All supported DevTest Releases.
Answer:

A delimited file is the same as a CSV (comma-separated value) file.   CSV files use double-quote marks to delimit field values that have spaces, so a value like Santa Claus gets saved as “Santa Claus” to preserve the space.  If a field value contains double-quotes, then the double-quotes get doubled-up so the parser can tell the difference.  Case in point, if the CSV field is “Santa Claus” the returned value is Santa Claus.  If the CSV field has “”Santa Claus””, the returned value is “Santa Claus” – the double-quote marks are part of the value, not just a delimiter around the value.

 In JSON, fields have quotations, such as { “firstName” : “Santa” } . As such, the quotation marks are part of the value (from a CSV file’s point-of-view), so these get saved as “”firstName””,””Santa””.

 Our Save to Delimited File has no idea the content is JSON, it just sees quotes and presumes the quotes are part of the field’s value and wraps the quotes in quotes accordingly.