[Seaside] WAJsonCanvas

Johan Brichau johan at inceptive.be
Mon Feb 24 18:47:43 UTC 2014

Hi Esteban,

> But even when it's not a common use case scenario, you could have a
> mixed objects array.
> Something like: ['string', 3.14, {key: 'value', foo: 'baz'}, [...], false]
> In that case it wouldn't be just "extending" the WAJsonObjectBrush
> openTag, but it should be something at other level, that let you
> manage the elements any way you want. Hence the #element: method.

I believe this is exactly the way #value: works.
Is there a reason why the following does work for you in such a case?

WAJsonCanvas builder render: [ :json |
	json value:  (Array with: 'string' with: 3.14 with: (Dictionary new at: 'key' put: 'value';yourself))

The way I understand how the canvas is designed is that #value still supports the 'old-style' conversion of Smalltalk object to json, and that #object:, #array, etc. allow to build json directly without the intermediate stop of building arrays and dictionaries. But I must admit I have not played with the JSON Canvas in 3.1 yet.


More information about the seaside mailing list