我想在服务类中返回一个 JSON 文字
@GraphQLQuery(name = "renderUI", description = "Schema for your form")
public String renderUI() {
String genratedSchema = "{" +
" \"schema\": {" +
" \"type\": \"object\"," +
" \"id\": \"urn:jsonschema:profile:model:DemoForm\"," +
" \"properties\": {" +
" \"comment\": {" +
" \"type\": \"string\"," +
" \"title\": \"Comment\"" +
" }" +
" }" +
" }," +
" \"form\": [" +
" {" +
" \"key\": \"comment\"," +
" \"type\": \"textarea\"," +
" \"required\": false," +
" \"description\": \"Add your Comment here\"," +
" \"placeholder\": \"fill your comment please\"" +
" }" +
" ]" +
"}";
return genratedSchema;
}
上面的代码转义了响应中的所有引号
{
"data": {
"renderUI": "{ \"schema\": { \"type\": \"object\", \"id\": \"urn:jsonschema:com:fnstr:bankprofile:gppbankprofile:model:DemoForm\", \"properties\": { \"comment\": { \"type\": \"string\", \"title\": \"Comment\" } } }, \"form\": [ { \"key\": \"comment\", \"type\": \"textarea\", \"required\": false, \"description\": \"Add your Comment here\", \"placeholder\": \"fill your comment please\" } ]}"
}
}
如何删除转义字符?