sahilpaudel
Modifying the response array objects
I want to get just the id and name from the object the rest of the data are irrelevant to me.
Can you pleas help me how to go about that.
def call(param) do
System.get_env("LOCATION_SERVICE_HOST") <> param
|> HttpClient.get
|> format_response
end
def format_response({ok, response}) do
response
end
The response of call function
[
{
"countryCode": "IN",
"courierApplicable": false,
"id": 1,
"isActive": true,
"name": "",
"stateId": 5,
"supplierCityId": 1
},
{
"countryCode": "IN",
"courierApplicable": false,
"id": 2,
"isActive": true,
"name": "",
"stateId": 1,
},
...
]
Expected result
[
{
"id": 1,
"name": ""
},
{
"id": 2,
"name": ""
},
...
]
Most Liked
sahilpaudel
Last Post!
kokolegorille
This would have worked too
|> Enum.map(& %{id: &1.id, name: &1.name})
BTW “id” is not equal to id:, but the working code uses :id…
0
Popular in Questions
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
I would like to know what is the best IDE for elixir development?
New
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
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
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
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
Other popular topics
Hello, how can I check the Phoenix version ?
Thanks !
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 the...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Phoenix 1.4.0 released
Phoenix 1.4 is out! This release ships with exciting new features, most notably
with HTTP2 support, improved deve...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Latest Phoenix Threads
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
- #forms
- #api
- #metaprogramming
- #hex
- #security









