0

I have the code as below

    @RequestMapping(method = RequestMethod.POST)
    public @ResponseBody ServiceResponse submitCustomerOrder(@RequestBody SubmitCustomerOrderRequest submitCustomerOrderRequest,HttpServletRequest request)
    {
     String json=????
    }

I need the de-serialization should happen to SubmitCustomerOrderRequest object but also need the raw json request in the string for logging the request purpose.

Can anybody help me on this.

usha
  • 28,973
  • 5
  • 72
  • 93
Vawani
  • 399
  • 10
  • 25
  • Possible duplicate of [Retrieving JSON Object Literal from HttpServletRequest](http://stackoverflow.com/questions/1548782/retrieving-json-object-literal-from-httpservletrequest) – Alan Hay Nov 10 '16 at 23:47

1 Answers1

0

Use google's Gson library

log.info(new Gson().toJson(submitCustomerOrderRequest))
usha
  • 28,973
  • 5
  • 72
  • 93