Вопрос

In general, jackson is serialize beans to standard json format, for example, the following class:

public class Person {
    private String name;
    private int age;
    // getter/setter
}

will serialize to following json:

{
  "name" : "test1111",
  "age" : 18
}

but i want to get the format like this(non-standard):

{
  name : test1111,
  age : 18
}

that is to say, i didn't want to output the double-quote despite of the type. Thanks for help in advance!

Это было полезно?

Решение

That is not valid JSON and therefore you cannot use Jackson to generate it.

If you want, you can use Jackson to generate a String value of

{
  "name" : "test1111",
  "age" : 18
}

and then manually remove the quotes.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top