[英]Using Play for Scala, how do I read in JSON body {a=…,b=…,c…} from POST request?
I have a JSON body arriving in a POST
request. 我有一个JSON主体到达
POST
请求。 For simplicity sake, let's say it is: 为了简单起见,假设它是:
{"a":1,"b":2,"c":3,"d":4}
How do I read those values into variables a
, b
, c
, d
in a Play controller, and what should the appropriate line in the routes file look like? 如何在Play控制器中将这些值读入变量
a
, b
, c
和d
,以及routes文件中的相应行应该是什么样?
val a = (body \ "a").as[Long]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.