My question is simple .
MappingJackson2HttpMessageConverter
is available in spring for data serialization from any rest service to client. Now I am working on another project and it has recommendation to use JODD json. I am confused how to configure same in spring project as a
custom and generic to all Json convertor
for all RestApi Responses.
Thanks , in Advance
If I understood correctly, you want to know how to do the mapping between types and JSON. Jodd is doing this as best it can with what's given to it. For serialization, just give the object, Jodd will parse. For parsing, just provide the target class, and Jodd will try to do the best to create all the possible classes, with regards of current types, generics, etc.
Sometimes you need more:
annotations
With annotations you can fine tune e.g. naming and what is going to be serialized. Just add
@JSONannotation to classes/methods/fields and tweak.serializers and parsers
But you can specify specific serializer or parser for each type you wanna process. Use:
to add a new
TypeJsonSerializer, orto add a new
TypeJsonParser.Note:
TypeJsonParserMapis not yet released, but will be soon.