[fpc-pascal] JSON - RTTI streaming.

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Mon May 16 09:07:09 CEST 2011

On Mon, 16 May 2011, Burkhard Carstens wrote:

> Am Donnerstag, 6. Januar 2011 00:12 schrieb Michael Van Canneyt:
>> Hello,
>> For those of you that need JSON support:
>> I have committed support for streaming published properties
>> (properties for which RTTI  is generated) from objects to
>> JSON and vice versa, in a unit fpjsonrtti.
>> Not the full streaming as implemented in the classes system is
>> supported: - No DefineProperties.
>> - No methods.
>> Although it should not be difficult to add support for this.
>> In contrast, it can stream simple collections and stringlists
>> (with ojects attached) in various ways.
>> There are various events to influence the streaming process.
>> This should be more than enough to stream objects to and from a
>> web-browser.
>> I have committed an example and a testsuite.
>> All this is in packages/fcl-json.
>> Despite the fact that the testsuite runs OK ,
>> I'd like to ask those for whom it might be useful to test the
>> code and report any errors you find to me. Suggestions for
>> improvements are also welcome.
> This is great!
> A quick first test (streaming/destreaming a TPanel with childs) fails
> with: Unsuported JSON type for object property: "jtNull"
> This is line 296 in fpjsonrtti. Maybe jtNull should be interpreted as
> nil here..

It depends; jtNull can appear almost anywhere.
I guess that for pointer or class values, we can interpret it as Nil.
I'll have a look at that.


More information about the fpc-pascal mailing list