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"}
]