PDA

View Full Version : Really silly question



Mango_lier
5 Mar 2010, 10:42 AM
The brain cells are not working today, If I receive the json below, how do I configure the store for a ComboBox


{
"1": "Guest",
"2": "User",
"3": "Manager",
"4": "Admin"
}

Thanks

tobiu
5 Mar 2010, 11:13 AM
"": ,


is a really, really bad idea!


kind regards,
tobiu

Zdeno
5 Mar 2010, 11:48 AM
is a really, really bad idea!

agree why you dont use sth like


{ 0: "", 1: "Admin", 2: "User" ... }

httpdotcom
5 Mar 2010, 11:54 AM
For a proper store, you need to use KEY/VAL pairs.

{
{ KEY: 0, LEVEL: "" },
{ KEY: 1, LEVEL: "Guest" },
...
}

and then define your store fields config properly. It isn't hard to create proper JSON arrays in PHP, by simply creating the appropriate associative array and passing it through json_encode().

Animal
5 Mar 2010, 1:59 PM
I assume that's just a typo! An Array of Objects is [ ... ]

Mango_lier
5 Mar 2010, 3:34 PM
Thanks all for looking, found the stupid solution for the stupid backend environment. This VBScript is evil.