Skip to content

Commit

Permalink
Merge pull request #202 from Sleepful/master
Browse files Browse the repository at this point in the history
Add example to create JSON string without escaped characters
  • Loading branch information
dakrone authored Nov 30, 2023
2 parents 9ba8096 + 6306b0c commit ceb3307
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ encoders.
;; generate JSON and munge keys with a custom function
(generate-string {:foo "bar"} {:key-fn (fn [k] (.toUpperCase (name k)))})
;; => "{\"FOO\":\"bar\"}"

;; generate JSON without escaping the characters (by writing it to a file)
(spit "foo.json" (json/generate-string {:foo "bar"} {:pretty true}))
```

In the event encoding fails, Cheshire will throw a `JsonGenerationException`.
Expand Down

0 comments on commit ceb3307

Please sign in to comment.