Getting only a single result in json

Guys, how do I bring only the result with the name “TEST1”, from a json?

I don’t want values other than TEST1 to come out

Function:

  def user_list() do
    json_atoms = Json.Result.list() |> Poison.encode!() |> Poison.decode!(keys: :atoms)
     Enum.map(json_atoms.members, & %{id: &1[:id], real_name: &1[:real_name]})
  end

Result:

[
  %{id: "TEST1", real_name: "MyTest1"},
  %{id: "TEST2", real_name: "MyTest2"},
  %{id: "TEST3", real_name: "MyTest3"},
  %{id: "TEST4", real_name: "MyTest4"}
]

You should filter the list

def user_list(id) do
    json_atoms = Json.Result.list() |> Poison.encode!() |> Poison.decode!(keys: :atoms)
    json_atoms.members
    |> Enum.filter(& &1.id == id)
    |> Enum.map(& %{id: &1[:id], real_name: &1[:real_name]})
end

not tested… but You should be able to do

user_list("TEST1")

Really and that’s right,
Thank you very much, it worked.