forcex icon indicating copy to clipboard operation
forcex copied to clipboard

Switch from Poison to Jason

Open fastjames opened this issue 3 years ago • 3 comments

Poison has gone several months without a merge or update, and newer projects appear to prefer Jason for performance reasons. Since forcex only uses Poison in 3 or 4 locations, I'm hopeful that the conversion would be straightforward.

fastjames avatar Jun 30 '22 16:06 fastjames

One point that caught my eye was that the current calls to Poison.decode!/2 look like this:

Poison.decode!(body, keys: :atoms)

The keys: :atoms option is supposed to use atoms for the map keys in the output. However, I reviewed the repo history and when it switched from JSX to Poison (https://github.com/jeffweiss/forcex/commit/c19d34fa4492bc501b24251253e7922529a2169a), that option was not already in use on the JSX call. This is relevant because as far as I can tell, Jason does not offer an option to use atoms as keys when decoding.

fastjames avatar Jun 30 '22 16:06 fastjames

WIP branch here: https://github.com/fastjames/forcex/tree/poison_to_jason

fastjames avatar Sep 29 '22 20:09 fastjames

Also, I learned that Jason added the keys: :atoms option in a later version than the one I was viewing, so the transition is very clean.

fastjames avatar Oct 04 '22 21:10 fastjames