random_user v0.3.0 RandomUser.Parser

Parser helps you format the JSON output and easily access the data.

Examples

res = RandomUser.Random.one |> RandomUser.Parser.results |> RandomUser.Parser.parse

Summary

Functions

This will convert map keys to atoms and allow you to access keys with dot notation

Retrieve the relevant results

Functions

parse(results)

This will convert map keys to atoms and allow you to access keys with dot notation

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)
results(response)

Retrieve the relevant results

Examples

RandomUser.Random.one |> RandomUser.Parser.results
RandomUser.Random.multiple(2) |> RandomUser.Parser.results