我想使用List<String> requestBody
String
变成Jackson
[{"userId":"GZiLXipGgoZeZBCy","displayName":"759383","role":"FATHER"},
{"userId":"HKtpZCfBlfMEiYaH","displayName":"291848","role":"SON"}]
所以我使用Jackson实现了这个:
["{\"userId\":\"GZiLXipGgoZeZBCy\",\"displayName\":\"759383\",\"role\":\"FATHER\"}",
"{\"userId\":\"HKtpZCfBlfMEiYaH\",\"displayName\":\"291848\",\"role\":\"SON\"}"]
我的代码是:
final OutputStream out = new ByteArrayOutputStream();
final ObjectMapper mapper = new ObjectMapper();
mapper.writeValue(out, requestBody);
final String data = out.toString();
有人可以帮我修复String
吗?
(我的request
需要String
而不是List<String>
)
由于