> AFAIK an object in JSON is just an associative array in PHP, 
> so I don't see the point here in implementing that in 
> anything else than an associative array on the PHP side.
> 

The json extension currently creates stdClass objects.

$config = '{"windowA":
        {
                "left": 10,
                "right": 10,
                "height": 100,
                "width": 100
        },
        "windowB":
        {
                "left": 120,
                "right": 120,
                "height": 120,
                "width": 120
        }
}';

$a = json_decode($config);

var_dump($a);

Outputs:

object(stdClass)#1 (2) {
  ["windowA"]=>
  object(stdClass)#2 (4) {
    ["left"]=>
    int(10)
    ["right"]=>
    int(10)
    ["height"]=>
    int(100)
    ["width"]=>
    int(100)
  }
  ["windowB"]=>
  object(stdClass)#3 (4) {
    ["left"]=>
    int(120)
    ["right"]=>
    int(120)
    ["height"]=>
    int(120)
    ["width"]=>
    int(120)
  }
}


Also it'd been nice if the requirement to have name/label in double quotes was 
removed, (I havent read a JSON spec, so it maybe
correct) but javascript doesn't require it.

Jared

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to