Does anyone have an example of using Ecto Schemas for parsing JSON api responses?
I’m curious how you can convert this
{
"id": 283230,
"fname": "John",
"lname": "Smith",
"email": "john.smith@example.com",
"createdOn": "2016-03-31T10:49:11.386-05:00",
"updatedOn": "2016-10-31T16:36:12.968-05:00",
"_embedded": {
"addresses": [
{
"city": "Minneapolis",
"state": "MN"
},
{
"city": "New Orleans",
"state": "LA"
}
]
}
}
into this
%User{
id: 283230,
fname: "John",
lname: "Smith",
email: "john.smith@example.com",
createdOn: "2016-03-31T10:49:11.386-05:00",
updatedOn: "2016-10-31T16:36:12.968-05:00",
addresses: [
%Address{
"city": "Minneapolis",
"state": "MN"
},
%Address{
"city": "New Orleans",
"state": "LA"
}
]
}