Techiee Techiee - 1 year ago 149
JSON Question

How to get rid of "value" from swagger json {"value" :"{\"swagger\":\"2.0\", \"info\"{\" description?

I am Using GsonHttpMessageConverter in my spring project. When I use swagger, it is generating json with "Value" like {"value" :"{\"swagger\":\"2.0\", \"info\"{\" description ...

Which will actually break in swagger UI because of the above format. It shouldn't generate "value" tag, but it is generating. Is there any proper way to address this issue?

Answer Source

Try serilaizing your class as follows:

package springfpackage springfox.documentation.spring.web.json;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.annotation.JsonValue;

public class Json {
  private final String value;

  public Json(String value) {
    this.value = value;

  public String value() {
    return value;

And then check it should work fine!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download