ar0lak
Problems encoding a nested map with poison
Can seem to encode this this json with Poison v4, using phoenix v1.4.1, getting error related to erlang.byte_size(…)
Any help would be appreciated.
** (Mix) Could not start application tradebot: Tradebot.Application.start(:normal, []) returned an error: shutdown: failed to start child: FTX.Client
** (EXIT) exited in: WebSockex.call(#PID<0.344.0>, {:text, {:ok, "{\"args\":{\"key\":\"fooooobaaarrrrbazzzzzzzz\",\"sign\":\"d10b5a67a1a941ae9463a60b285ae845cdeac1b11edc7da9977bef0228b96de9\",\"time\":\"1572290285343518000\"},\"op\":[108,111,103,105,110]}"}})
** (EXIT) an exception was raised:
** (ArgumentError) argument error
:erlang.byte_size({:ok, "{\"args\":{\"key\":\"fooooobaaarrrrbazzzzzzz\",\"sign\":\"d10b5a67a1a941ae9463a60b285ae845cdeac1b11edc7da9977bef0228b96de9\",\"time\":\"1572290285343518000\"},\"op\":[108,111,103,105,110]}"})
(websockex) lib/websockex/frame.ex:374: WebSockex.Frame.get_payload_length_bin/1
(websockex) lib/websockex/frame.ex:324: WebSockex.Frame.encode_frame/1
(websockex) lib/websockex.ex:897: WebSockex.sync_send/5
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Marked As Solved
idi527

Seems like you are encoding it just fine, but the result is a tagged tuple, {:ok, json}. You can either extract the json value from the tuple or use a “bang” version of the encoding command which returns the value directly.
3
Popular in Questions
can someone please explain to me how Enum.reduce works with maps
New
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”:
14:57:30.512 [warn] ...
New
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size?
Thanks
New
Other popular topics
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir? ...
New
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I'm writing a test for one of t...
New
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
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
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New







