January 8, 2017

Amazon Mobile Analytics: com.amazon.coral.service SerializationException not an expected Json type

When trying to submit a custom event having attributes and metrics to Amazon Mobile Analytics, I got the following error:

object(stdClass) {
 __type => 'com.amazon.coral.service#SerializationException'
 Message => 'class java.lang.String is not an expected Json type'
}

The problem was the data type of the attributes and metrics I was trying to send. AWS REST API has strict requirements for those. The solution was to convert attribute values to strings (strval()) and metrics to integers (intval()).

No comments: