• Post Reply Bookmark Topic Watch Topic
  • New Topic

Map or Hashmap to json

 
david dabush
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

@RequestMapping(value = { "/mapping" }, method = RequestMethod.GET)
@ResponseBody
public Map<A, List<B>> getAsByB(HttpServletRequest httpRequest) {
return map;
}

when i try to get it by url i get an error.
how can i send a response of a map as a json ?

 
Silviu Burcea
Ranch Hand
Posts: 61
1
IntelliJ IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What error do you get? A and B are serializable?
 
david dabush
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Silviu Burcea wrote:Hi,

What error do you get? A and B are serializable?


A is enum
the two are not seriazable.

but the server is already making jsons fron non seriazable objects.

errror: HTTP Status 500 - Could not write JSON: EL1011Epos 2): Method call: Attempted to call method...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!