-1

I am getting a JsonObject that i need to return it as a raw json in spring mvc in the controller. Using @ResponseBody doesn't work. So it's either i fix in the controller or i render it in a jsp , so any idea about any of these 2 solutions? Note that i don't always know the type of the object returned in the json

pedrov
  • 35
  • 7
  • possible duplicate of [Returning JsonObject using @ResponseBody in SpringMVC](http://stackoverflow.com/questions/19204048/returning-jsonobject-using-responsebody-in-springmvc) – Neeraj Jain Mar 10 '15 at 12:31
  • Using toString is what i have right now , i am looking for a different method since that function is consuming a lot of memory – pedrov Mar 10 '15 at 12:36

2 Answers2

0

Are you able to return String? If so, use Json encoder and decoder. For example, JSON-lib.jar can be used to do these.

ch271828n
  • 15,854
  • 5
  • 53
  • 88
  • I can return a string , but i have a big application and using the toString method is using a lot of heap space which is not ideal. – pedrov Mar 10 '15 at 12:30
0

Here are few links that will help you

Returning JsonObject using @ResponseBody in SpringMVC

Spring configure @ResponseBody JSON format

Community
  • 1
  • 1
rns
  • 1,047
  • 10
  • 25