manhvu

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

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:

  1. Updated the toon_ex library by adding a missing function so Phoenix can encode terms to iodata, and fixed some bugs.
  2. Updated the Phoenix config:
# Use Jason for JSON parsing in Phoenix
# config :phoenix, :json_library, Jason
config :phoenix, :json_library, ToonApp.MyToon
  1. Created a simple client in Elixir to verify it. I used the phoenix_client library.

Updated toon_ex repo. My PoC

Also Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Make sure that you’re comparing the GZipped sizes in your bandwidth estimate. People tend to forget to do this.

sevenseacat

sevenseacat

Author of Ash Framework

Someone really looked at JSON and said ‘you know what this needs? To be more like YAML because everyone loves YAML’?

dimitarvp

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

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.

Where Next?

Popular in Questions Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement