ar0lak

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

idi527

:waving_hand:

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.

Where Next?

Popular in Questions Top

Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&amp;query=perfume&amp;page=2, I would like to get: ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
stefanchrobot
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
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; somethi...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
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

Other popular topics Top

vertexbuffer
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
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Qqwy
Update: How to use the Blogs &amp; Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126479 1222
New

We're in Beta

About us Mission Statement