Dear Play Framework users,
I'm trying to convert json to Seq[Either[Profile, Page]]
Here are Profile and Page case classes:
case class Page(id: Int, name: String, screen_name: String, is_closed: Int, photo_50: String, photo_100: String, photo_200: String)
case class Profile(id: Int, first_name: String, last_name: String)
Sample json:
{
"response":{
"count":3,
"items":[
{
"id":2158488,
"name":"LIVE",
"screen_name":"live",
"is_closed":0,
"type":"page",
"photo_50":"https://pp.vk.me/c623416/v623416604/10e29/AUwb4GWpbD4.jpg",
"photo_100":"https://pp.vk.me/c623416/v623416604/10e28/DNSjabzHo70.jpg",
"photo_200":"https://pp.vk.me/c623416/v623416604/10e26/UAWL2PWZ_wM.jpg"
},
{
"id":11982368,
"name":"Forbes",
"screen_name":"forbes",
"is_closed":0,
"type":"page",
"photo_50":"https://pp.vk.me/c621326/v621326364/46b3/PE8CH3wuGSU.jpg",
"photo_100":"https://pp.vk.me/c621326/v621326364/46b2/_K_Pn8ayf08.jpg",
"photo_200":"https://pp.vk.me/c621326/v621326364/46b1/U58-5jSTiHI.jpg"
},
{
"type":"profile",
"id":123456,
"first_name":"John",
"last_name":"Doe"
}
]
}
} I wonder how to write an implicit Reads for Either type.
Can someone please give me a hint on implementing this?