Hi,
Hi,I'm experimenting with a JSON converter for objects with Magritte descriptions. So far I've added the following to GRObject:jsonOn: aStream| description |description := self description.description children isEmpty ifFalse: [| first |first := true.aStream nextPut: ${.description do: [ :each |firstifTrue: [ first := false ]ifFalse: [ aStream nextPut: $, ].aStreamjson: each label;nextPut: $:;json: (each accessor read: self) ].aStream nextPut: $} ]you can then generate JSON from an object, for example:((PRPage named: 'examplePage') contents: '!!Hello', String crlf, 'Hello ""world"" check') asJsongives:'{"Name":"examplePage","Visibility":false,"Navigation Title":"ExamplePage","Tags":[],"Title":"ExamplePage","Owner":null,"Group":null,"Contents":{},"Plain Text":"Hello\rHello world check","Environment":null,"Style Sheet":null,"Shortcut Icon":null,"CSS Classes":null}'The method fails with recursive structures, but otherwise is appears to work well.Does this look like a sensible approach? Has anyone else implemented anything similar?ThanksNick
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki