我有这个要求:
curl -X "POST" "myURL" \
-H 'Content-Type: application/json' \
-H 'User-Agent: myAgent)' \
-H 'Accept-Language: it-IT' \
-d $'{ "Summary": { "Discount": 1.099, "TotalAmount": 9.891, "SubtotalAmount": 10.99 }, "Token": "token", "InstantDiscountId": "id" }'
但是我不知道如何用该JSON对象设置主体。使用Alamofire时,我总是在请求中使用[String:Any]作为参数,但事实并非如此。
答案 0 :(得分:0)
答案是将编码简单设置为List<String> list = Arrays.asList("select json,json from XXX","select json from json XXXX","select json,json from json XXX","select json from json json XXXX");
list.forEach(x -> {
System.out.println(x + " --> " + x.matches(".*\\bjson\\b(?:(?!\\bfrom\\b).)+\\bjson\\b.*"));
});
这就是代码的样子
select json,json from XXX --> true
select json from json XXXX --> false
select json,json from json XXX --> true
select json from json json XXXX --> true