When I serialize
public class FOO {
int field1;
String field2;
}
I got the following.
{"FOO":{"field1":0,"field2":"value"}}
Can you point me how can I make the output look like this
{"field1":0,"field2":"value"}
I've figured out how to make it. Actually the problem is that MappingJacksonJsonView has a map So that's why it returns it that way {"FOO":{"field1":0,"field2":"value"}}
But If I configured it that way
<beans:bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView">
<beans:property name="extractValueFromSingleKeyModel" value="true" />
</beans:bean>
It will serialize the object itself not the whole map. I hope it will help someone else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With