cheshire icon indicating copy to clipboard operation
cheshire copied to clipboard

Any way to not escape the quotes

Open funston opened this issue 4 years ago • 2 comments

When the quotes are escapes, there are problems where some services are taking the string and double escaping it making decoding in difficult. For example, json.dumps in python won't add the "

Is there an option to support that here, ie

{"foo":"bar"}

instead of

{\"foo\":\"bar\"}

funston avatar May 16 '20 02:05 funston

It doesn't appear that there is a way to do this, see the available feature flags here: https://fasterxml.github.io/jackson-core/javadoc/2.10/com/fasterxml/jackson/core/JsonParser.Feature.html

dakrone avatar May 18 '20 13:05 dakrone

This works for me (print to stdout instead of returning):

#!/usr/bin/env bb

(do (println (json/generate-string {:foo "bar", :baz 5}))
    (json/generate-string {:foo "bar", :baz 5}))
$ bb test.clj
> {"baz":5,"foo":"bar"}
> "{\"baz\":5,\"foo\":\"bar\"}"

davidsierradz avatar Oct 24 '20 17:10 davidsierradz