json - Serializing Case Class -


this kind of strange issue i've been having. had case class many parameters, including string, , able serialize json straightforwardly using play's format. then, added parameter - string - , starts complaining

no unapply or unapplyseq function found

the original looked this:

case class pushmessage(stageone: boolean, stagetwo: boolean, stagethree: boolean, stagefour: boolean, stagefive: boolean,                    higheststage: int, iostotal: int, androidtotal: int, iosrunningcount: int, androidrunningcount: int,                    vendorid: string, androidproblem: boolean, ioscomplete: boolean, androidcomplete: boolean,                    totalstagethrees: int, totalstagefours: int, totalstagefives: int, expectedtotals: int,                    latestupdate: long, iosproblem: boolean, starttime: long, date: long) 

the new 1 looks

case class pushmessage(stageone: boolean, stagetwo: boolean, stagethree: boolean, stagefour: boolean, stagefive: boolean,                    higheststage: int, iostotal: int, androidtotal: int, iosrunningcount: int, androidrunningcount: int,                    vendorid: string, androidproblem: boolean, ioscomplete: boolean, androidcomplete: boolean,                    totalstagethrees: int, totalstagefours: int, totalstagefives: int, expectedtotals: int,                    latestupdate: long, iosproblem: boolean, starttime: long, date: long, topics: string) 

the difference parameter topics.

my serializer looks like:

    object pushmessage {    implicit val pushmessageformat = json.format[pushmessage]  } 

any , appreciated. thanks.

play uses macros , tuples derive json instance. problem tuples limited 22 fields in scala (at least @ moment).

that means play won't able automatically derive json instance, although can work around manually writing it.

you can find more info here: play framework scala format large json (no unapply or unapplyseq function found)


Comments