cancel
Showing results for 
Search instead for 
Did you mean: 

Outputting empty (not null) JSON

DBMan63
New Contributor

I need to output JSON to a file and I’m struggling to get my pipeline to output what I want, and created the following as a really cut down example:
A JSON Generator containing the following (purely as an example, the real JSON is much ,more complicated): [{“title”:“”}]
A JSON Formatter that simple outputs the JSON
A File Writer that writes a file to the sldb

The JSON is meant to represent a field that has a blank value, but not a NULL value. The output from the JSON Formatter is this: [{“title”:“}]
i.e. there is only one double-quote for the value of the key. Can anyone tell me how I can get the output to be [{“title”:”"}] with two double-quotes for the value? I know this is valid JSON and some our systems output this when the DB field is blank.
Thanks

2 REPLIES 2

alchemiz
Contributor III

Hi @DBMan63,

Good day, see sample mapping details below how to write double-quotes without escaping… you can also use "\"\"" to write double-quotes in a JSON format file

image

Preview data from the JSON formatter
(Text not showing all double-quotes)
image
(Hex view all double-quotes are showing)
image

test.json (269 Bytes)

hope this helps
MM

DBMan63
New Contributor

Thanks, Mike. I’d already tried using some of those but I think I’ve run into the “undocumented feature” I found in other searches where the Text view doesn’t show two double-quotes correctly and didn’t check whether the output file was correct or not.

Thanks for your clarification however.

Steve