muuntaja icon indicating copy to clipboard operation
muuntaja copied to clipboard

Add charred json formatter module

Open nikolap opened this issue 1 year ago • 4 comments

This PR adds charred as a JSON encode/decoder module for muuntaja, like cheshire.

The code comes from a private project that uses muuntaja + reitit.

Open to suggestions for how to test and build it locally in the context of this repo, as well as any change requests.

nikolap avatar Nov 18 '23 19:11 nikolap

Hi! This looks very good, but it'd need some tests. Would you be able to add those? You can see how the Cheshire integration is tested here https://github.com/metosin/muuntaja/blob/master/test/muuntaja/core_test.clj For Charred, it'd be essentially the same tests needed.

mvarela avatar Dec 20 '23 15:12 mvarela

Thanks! Do you have any advice for how to run the project locally, i.e. dev setup? This is where I struggled to figure out how to add and run tests.

nikolap avatar Dec 20 '23 15:12 nikolap

You can try lein with-profile default,dev repl, which should get you an nREPL server with the dev profile loaded.

mvarela avatar Dec 21 '23 13:12 mvarela

Thanks, that helped me get started. Changes in last commit:

  • Added charred tests
  • Updated encoding handler for charred (default to encode-unicode false now, see opts in https://github.com/cnuernber/charred/blob/master/src/charred/api.clj#L708)
  • Updated Contributing docs
  • Add charred module to the scripts file
  • Fix charred dep not loading properly

Let me know if anything else seems off!

nikolap avatar Dec 30 '23 08:12 nikolap

This is so great! I considered doing this (around the same time that you were actually just doing it, apparently).

With this I think we can perhaps remove cheshire + jsonista and other conflict ridden deps from some of our infrastructure pathways and for that I am grateful. Thanks all! :bow:

harold avatar Mar 15 '24 15:03 harold