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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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
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