Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spray.json.SerializationException: Map key must be formatted as JsString, not '7375' #173

Closed
zhenghub opened this issue Dec 7, 2015 · 2 comments

Comments

@zhenghub
Copy link

zhenghub commented Dec 7, 2015

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)

@wlk
Copy link

wlk commented Mar 15, 2016

This is a duplicate of: #125

@ktoso ktoso closed this as completed Dec 5, 2016
@ktoso
Copy link
Member

ktoso commented Dec 5, 2016

Closing as duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants