I'm having serious problems deserializing the JSON array for a Scala object
[{"name":"Cool","city":"College Park","address":"806","id":1},{"name":"Mars ","city":"Durham","address":"12","id":2},{"name":"Something","city":"Raleigh ","address":"","id":3},{"name":"test","city":"","address":"","id":5}]
I tried gson, jerkson (jackson Scala wrapper), sjson, flexjson. None of them worked. I have a list of clients. List [Client].
This is the closest I have:
val array = new JsonParser().parse( customers ).getAsJsonArray()
This gave me 4 arrays. However, this obviously did not give me the client object. I tried Jerkson.
val array = parse[List[Customer]](customers)
But I understand that.
GenericSignatureFormatError occured : null
I'm just trying to find an easy way, like in Java.
Here is my Scala class.
case class Customer( id : Pk[ Int ], name : String, address : Option[ String ], city : Option[ String ], state : Option[ String ], user_id : Int ) object Customer extends Magic[ Customer ]( Option( "Customer" ) ) { def apply( name : String, address : String, city : String, state : String, user_id : Int ) = { new Customer( NotAssigned, name, Some( address ), Some( city ), Some( state ), user_id ) } def delete( id : Int ) = { SQL( "DELETE from Customer where id = {id}" ).onParams( id ).executeUpdate() } }
Thanks for any help.