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