Is there a way to get TJson.ObjectToJsonString() properly serialize a TNullableInteger field in an object?
I tried to use an attribute on the field using a JsonReflectAttribute with a TJSONInterceptor, but then the integer value, if present, was serialized as string.
JSON serialization that comes with Delphi is a disaster - as already mentioned in the comment to your question the design of
REST.Jsonprevents any customization of record serializion from what I can see.The only way known to me is to use a
TJsonSerializerfromSystem.JSON.Serializersand add a custom converter that can handleNullable<T>quite easily: