[英]Playframework, convert map to json
I have a map (this is in a scala template file) 我有一张地图(在scala模板文件中)
<Integer, Map<Integer, Double>>
How do i convert this to a json string? 如何将其转换为json字符串?
I've tried 我试过了
@Json.stringify(Json.toJson(moduleId2DecileMap))
This does not work, it complains that it doesn't know what to do with a Map (sigh). 这行不通,它抱怨说它不知道如何处理地图(叹气)。
GSON isn't available, as whenever I import GSON playframework bursts, so I need a solution using the in-built play json thing or some other json framework. GSON不可用,因为每当导入GSON playframework突发时,因此我需要使用内置play json或其他json框架的解决方案。
OH i was using the wrong import- i had 哦,我使用的输入错误-我有
@import play.api.libs.json._
YOU NEED 你需要
@import play.libs.Json
OH i was using the wrong import- i had 哦,我使用的输入错误-我有
@import play.api.libs.json._
YOU NEED 你需要
@import play.libs.Json
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.