On Fri, 7 Aug 2020, Ryan Joseph via fpc-pascal wrote:



On Aug 7, 2020, at 7:58 PM, Michael Van Canneyt <mich...@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.

An option to allow nulls to be detected and handles would of course be a nice
addition.

For the time being, you can just set jdoIgnorePropertyErrors on the destreamer 
options.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to