You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Map[Int, Int] type value called deltaTime. And when I "import DefaultJsonProtocol._" and invoke "deltaTime.toJson", spray.json tell me an exception as below. Does spray.json require the key of Map must be of String type?
Exception in thread "main" spray.json.SerializationException: Map key must be formatted as JsString, not '7375'
at spray.json.CollectionFormats$$anon$3$$anonfun$write$3.apply(CollectionFormats.scala:53)
at spray.json.CollectionFormats$$anon$3$$anonfun$write$3.apply(CollectionFormats.scala:50)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.HashMap$HashMap1.foreach(HashMap.scala:224)
at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:403)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at spray.json.CollectionFormats$$anon$3.write(CollectionFormats.scala:50)
at spray.json.CollectionFormats$$anon$3.write(CollectionFormats.scala:48)
at spray.json.PimpedAny.toJson(package.scala:39)
The text was updated successfully, but these errors were encountered:
I have a Map[Int, Int] type value called deltaTime. And when I "import DefaultJsonProtocol._" and invoke "deltaTime.toJson", spray.json tell me an exception as below. Does spray.json require the key of Map must be of String type?
Exception in thread "main" spray.json.SerializationException: Map key must be formatted as JsString, not '7375'
at spray.json.CollectionFormats$$anon$3$$anonfun$write$3.apply(CollectionFormats.scala:53)
at spray.json.CollectionFormats$$anon$3$$anonfun$write$3.apply(CollectionFormats.scala:50)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.HashMap$HashMap1.foreach(HashMap.scala:224)
at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:403)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at spray.json.CollectionFormats$$anon$3.write(CollectionFormats.scala:50)
at spray.json.CollectionFormats$$anon$3.write(CollectionFormats.scala:48)
at spray.json.PimpedAny.toJson(package.scala:39)
The text was updated successfully, but these errors were encountered: