Menu

Sending List instead of Map?

Help
2008-05-09
2013-04-29
  • Yves Callewaert

    Yves Callewaert - 2008-05-09

    Hello,

    I am using gwt-ext. Some Json data are requested to be in the following format:

    [{ 'id': 1, 'text': 'A folder Node', 'leaf': false },
    { 'id': 2, 'text': 'A leaf Node', 'leaf': true }]

    meaning it is a list, not a map.

    Could you tell me how to do this with the JSonView in json-lib-ext-spring-1/0.jar ?

    Seems that ModelAndView from Spring requests a Map...

    Thank you very much,

    Yves.

     
    • aalmiray

      aalmiray - 2008-05-09

      Hi Yves,

      Short answer: you can't at the moment as the view will always output a Map for the time being. Looking at the code it would be a simple matter of adding a flag to JsonView allowing you to force a top level JSONArray instead of a top level JSONObject. I'll get to it as soon as I get some rest from JavaOne.

      Please feel free to add a Feture Request to the issue tracker =)

      Cheers,
      Andres

       
    • aalmiray

      aalmiray - 2008-05-14

      Hi Yves,

      I've released json-lib-ext-spring 1.0.1, JsonView now has a setForceTopLevelArray flag that will let you write the required output.

      Cheers,
      Andres

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.