Pregunta

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!

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top