manhvu
How to replace JSON with TOON?
Hi, I’m looking for a way to replace JSON in Phoenix (LiveView & Channel) with TOON to save resources and get faster parsing. Has anyone tried something similar or have any suggestions?
Marked As Solved
manhvu
Thank you all for your support.
Based on the suggested library from @xu-chris, I created a PoC using TOON with Phoenix Channels.
My approach:
- Updated the
toon_exlibrary by adding a missing function so Phoenix can encode terms toiodata, and fixed some bugs. - Updated the Phoenix config:
# Use Jason for JSON parsing in Phoenix
# config :phoenix, :json_library, Jason
config :phoenix, :json_library, ToonApp.MyToon
- Created a simple client in Elixir to verify it. I used the
phoenix_clientlibrary.
Also Liked
benwilson512
Make sure that you’re comparing the GZipped sizes in your bandwidth estimate. People tend to forget to do this.
sevenseacat
Someone really looked at JSON and said ‘you know what this needs? To be more like YAML because everyone loves YAML’?
dimitarvp
And while he’s at it, he should compare the Brotli compressed payload sizes as well. Many CDNs and modern browsers support that as well.
Last Post!
manhvu
Actually, I renamed and published it under a different name. I want to optimize it and add more supporting functions for use with Phoenix Channels.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









