json - Efficient way of parsing Jax-ws Restful Response -
i need parse jax-ws rest response , tried following 2 ways of parsing response.both works good.but in need know best efficient way of implementation.please provide me view.
first approach:
- use getentity object , response input stream.
- using jackson objectmapper readvalue() -covert inputstream java object.
- using getters , setters of nested java class response objects member values.
second approach:
- use getentity object , response input stream , and convert input stream string.
- using google json api,convert string json object.
- using json parser , nested objects member values.
i first approach better 2 reasons:
- you don't go through intermediate process of reading response payload string
- the setter methods called during jackson deserialization may perform validation on input , throw appropriate exceptions, validation during deserialization.
Comments
Post a Comment