You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Obster <mi...@obster.org> on 2009/12/10 07:38:37 UTC

[Struts 2.1.8.1] [JSON] How to build a JSON for jsTree (array without variable name)

Hi,

I'm trying to build a correct JSON for usage with jsTree. Therefor I 
need s.th. like that:
[
   { attributes: { id : "pjson_1" },
                  data: "Root node 1",
   },
   { attributes: { id : "pjson_5" },
                  data: "Root node 2" }
]

As you can see if you need to root nodes in the tree you have to put 
them in an array, but I don't know how I can build the structure with 
the json-plugin from struts 2.1.8.1. Using a variable with getter and 
setter creates always s.th. like:
varname: ...

Can anyone tell how this is done?

Kind regards,
Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [Struts 2.1.8.1] [JSON] How to build a JSON for jsTree (array without variable name)

Posted by Musachy Barroso <mu...@gmail.com>.
The root object should be an array or list that contains a map or
object, and so on.

On Wed, Dec 9, 2009 at 10:38 PM, Michael Obster <mi...@obster.org> wrote:
> Hi,
>
> I'm trying to build a correct JSON for usage with jsTree. Therefor I need
> s.th. like that:
> [
>  { attributes: { id : "pjson_1" },
>                 data: "Root node 1",
>  },
>  { attributes: { id : "pjson_5" },
>                 data: "Root node 2" }
> ]
>
> As you can see if you need to root nodes in the tree you have to put them in
> an array, but I don't know how I can build the structure with the
> json-plugin from struts 2.1.8.1. Using a variable with getter and setter
> creates always s.th. like:
> varname: ...
>
> Can anyone tell how this is done?
>
> Kind regards,
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org