Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More control over what to what to read & write #63

Open
ikitommi opened this issue May 22, 2018 · 1 comment
Open

More control over what to what to read & write #63

ikitommi opened this issue May 22, 2018 · 1 comment

Comments

@ikitommi
Copy link
Member

ikitommi commented May 22, 2018

Jsonista has a good and fast api for reading and writing JSON. One can ask directly for JSON byte-array out of Clojure data - Jackson has optimized path just for this. With Muuntaja, one is forced to generate InputStream, which much slower, no benefits from NIO for example.

So, a new unified api, maybe directly from Jsonista:

(def data {:kikka "kukka"})

;; JSON
(m/write-value-as-string m "application/json" data)
(m/write-value-as-bytes m "application/json" data)
(m/write-value m "application/json" (File. "kikka.json") data)
(m/read-value m "application/json" (File. "kikka.json"))

;; EDN
(m/write-value-as-string m "application/edn" data)
(m/write-value-as-bytes m "application/edn" data)
(m/write-value m "application/edn" (File. "kikka.json") data)
(m/read-value m "application/edn" (File. "kikka.json"))
@ikitommi
Copy link
Member Author

Format to be written can be configured at the Muuntaja instance / format level, but not yet at request level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant