I am writing an Json parse for an rest webservice response, I have an Json file looking as:
{"program": {
"name": "myname",
"@id": "12345",
"$": "text text text"
}, etc. etc.
I wrote an case class for the Reads object:
case class program(name:String)
implicit val programFormat = Json.format[program]
And this pseudo code for get a data:
val x=(jobj \ "program").validate[program]
x match {
case JsSuccess(pr, _) => println("JsSuccess:"+pr)
for(p<- pr.program)
{
println(p.name)
}
case error: JsError => ....
}
For the field name no problem, the code work well, but I don't understand how capture the field "@id" and the field "$" because I cannot create an param in case class named: @id or $.
Thank you for your help.