RandomUser.Parser (random_user v0.3.5)
Parser helps you format the JSON output and easily access the data.
examples
Examples
res = RandomUser.Random.one |> RandomUser.Parser.results |> RandomUser.Parser.parse
Link to this section Summary
Functions
This will convert map keys to atoms and allow you to access keys with dot notation
Retrieve the relevant results
Link to this section Functions
Link to this function
parse(results)
This will convert map keys to atoms and allow you to access keys with dot notation
examples
Examples
# For one random user
res = RandomUser.Random.one |> RandomUser.Parser.results |> RandomUser.Parser.parse
res.gender
res.picture["large"]
# For multiple random users
users = RandomUser.Random.multiple(2) |> RandomUser.Parser.results
Enum.map(users, fn u ->
user = u |> RandomUser.Parser.parse
large_pic = user.picture["large"]
end)
Link to this function
results(response)
Retrieve the relevant results
examples
Examples
RandomUser.Random.one |> RandomUser.Parser.results
RandomUser.Random.multiple(2) |> RandomUser.Parser.results