I agree, I just provided that code a temporary work around ;)
panyasan wrote:
> Yes, but still the serializer should not choke in cases where a property is a
> plain object instead of a model. The result should be a valid json string in
> any case, I think.
>
> C.
>
>
> Noggin182 wrote:
>> You could just set goo to another model:
>>
>> model.setGoo(qx.data.marshal.Json.createModel({ mi: "moo", la: "lili" }));
>>
>>
>> 023684 playground.Application[96]:
>> {"foo":"foo","bar":"bar","goo":{}}playground.js (line 14218)
>> 023696 playground.Application[96]:
>> {"foo":"foo","bar":"bar","goo":{"mi":"moo","la":"lili"}}
>>
>> That seems to work.
>> Matt
>>
>>
>> panyasan wrote:
>>> Please test the following in the Playground:
>>>
>>> var data = {
>>> foo : "foo",
>>> bar : "bar",
>>> goo : {}
>>> };
>>>
>>> var model = qx.data.marshal.Json.createModel(data);
>>> this.info( qx.util.Serializer.toJson( model) );
>>>
>>> model.setGoo({ mi: "moo", la: "lili" });
>>> this.info( qx.util.Serializer.toJson( model) );
>>>
>>> http://demo.qooxdoo.org/devel/playground/#%7B%22code%22%3A%20%22var%2520data%2520%253D%2520%257B%250A%2520%2520foo%2520%253A%2520%2522foo%2522%252C%250A%2520%2520bar%2520%253A%2520%2522bar%2522%252C%250A%2520%2520goo%2520%253A%2520%257B%257D%250A%257D%253B%250A%250Avar%2520model%2520%253D%2520qx.data.marshal.Json.createModel%28data%29%253B%250Athis.info%28%2520qx.util.Serializer.toJson%28%2520model%29%2520%29%253B%250A%250Amodel.setGoo%28%257B%2520mi%253A%2520%2522moo%2522%252C%2520la%253A%2520%2522lili%2522%2520%257D%29%253B%250Athis.info%28%2520qx.util.Serializer.toJson%28%2520model%29%2520%29%253B%250A%250A%250A%2520%2520%2520%2520%250A%22%7D
>>>
>>> Result:
>>>
>>> 34082625 playground.Application[94]: {"foo":"foo","bar":"bar","goo":{}}
>>> 34082626 playground.Application[94]:
>>> {"foo":"foo","bar":"bar","goo":[object
>>> Object]}
>>>
>>> The "[object Object]" breaks the generated JSON. I would consider this a
>>> bug. Should I open one?
>>>
>>> C.
>>>
>>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>
>
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel