[fpc-pascal] Null values with JSON RPC

Ryan Joseph genericptr at gmail.com
Fri Aug 7 15:08:16 CEST 2020



> On Aug 7, 2020, at 7:58 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
> 
> By itself, fpJSON of course allows null values.
> 
> What are you using as a serialization technologgy ?

I didn't write the serialization layer and this is my first time using the FPCs RTTI system for this purpose. Having said that I think it's coming from TJSONStreamer or TJSONParser as it's trying to decode to a published property like:

    property rootUri: string read fRootUri write fRootUri;

It doesn't seem to know how to translate null to "string", which makes sense I guess but not getting a hard error would be nice simply because it was difficult to understand where it came from and what went wrong. Anybody else trying to integrate into a client will come across this also and be confused.

This is basically like a nullable types problem right? I need to modify the FPC serialization code or use a nullable string type instead of AnsiString.

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list