Esempio n. 1
0
    public function testComplexObject()
    {
        $writer = new JsonWriter("");
        $writer->startObjectScope();
        $writer->writeName("1");
        $writer->writeValue(2, "Edm.Int16");
        $writer->writeName("child");
        $writer->startObjectScope();
        $writer->writeName("array");
        $writer->startArrayScope();
        $writer->writeValue(100.00155, "Edm.Decimal");
        $writer->writeValue("Mar 3, 2012 11:14:32 AM", "Edm.DateTime");
        $writer->endScope();
        $writer->endScope();
        $writer->endScope();
        $expected = '{
    "1":2,"child":{
        "array":[
            "100.00155","2012-03-03T11:14:32"
        ]
    }
}';
        $this->assertEquals($expected, $writer->getJsonOutput());
    }