aronteh
List of nested maps help
Hi, I have the following nested map below:
ordered_contents =[
%{
"order_id" => 1234567,
"version" => 24,
"content" => [
%{
"contents" => [
%{
"id" => "551546104",
"level" => "",
"quantity" => 340,
"random" => true,
"type" => "resource"
},
%{
"id" => "229186523",
"level" => "",
"quantity" => 15,
"random" => true,
"type" => "resource"
}
],
"id" => 2323110,
"name" => "RSS Gold",
"type" => "U",
"version" => 24
}
]
},
%{
"order_id" => 1234568,
"version" => 24,
"content" => [
%{
"contents" => [
%{
"id" => "551546104",
"level" => "",
"quantity" => 300,
"random" => true,
"type" => "resource"
},
%{
"id" => "229186523",
"level" => "",
"quantity" => 40,
"random" => true,
"type" => "resource"
}
],
"id" => 2323110,
"name" => "RSS Silver",
"type" => "U",
"version" => 24
}
]
}
]
I am new to Elixir, how do I flatten the map to read all the map value or there any shorter way?
First Post!
benwilson512
Author of Craft GraphQL APIs in Elixir with Absinthe
Welcome! When you say “read all the map values” what do you have in mind? Can you provide an example of the kind of data you’re looking to generate from that input?
Popular in Questions
Hi all,
Trying to get some more clarity over utc_datetime and naive_datetime for Ecto:
https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
I would like to know what is the best IDE for elixir development?
New
Hello,
I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these
buyer = %{
id: ...
New
Hi,
I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
I will often find my self writing things similar to:
case some_value do
nil -> something()
"" -> something()
_ -> someth...
New
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: )
Hello all, this is ...
New
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size?
Thanks
New
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Other popular topics
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
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
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
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
Hi all,
I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage.
I'm trying to use Postg...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including.
What is Phoenix LiveV...
New
by Lance Halvorsen
Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
New







