Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special use case of NULL field value #131

Open
ertankucukoglu opened this issue May 12, 2023 · 2 comments
Open

Special use case of NULL field value #131

ertankucukoglu opened this issue May 12, 2023 · 2 comments
Assignees

Comments

@ertankucukoglu
Copy link

Hello,

There is a table where NULL value on float/integer fields mean something else than 0 (zero). But, MARS currently convert it into number zero in generated json string.

I could not find an option to keep NULL value as it is in DefaultMARSJSONSerializationOptions.

Did I miss it, or currently this is not possible?

Thanks & regards,
Ertan

@andrea-magni
Copy link
Owner

Hi, let me check I got it correctly:
you have a class or record with an integer 'MyField' property/member.
This property can (of course) assume zero as a value.
You would like to see a JSON serialization of this property as

  1. { "MyField": null, "MyOtherField": "Dummy" }
  2. { "MyField": 0, "MyOtherField": "Dummy" }
  3. { "MyOtherField": "Dummy" } // MyField is not present

Let me know what you would like to see implemented (and why possibly).
Sincererly,
Andrea

@ertankucukoglu
Copy link
Author

ertankucukoglu commented Oct 16, 2023

Hi,
Number 1 from your examples. Field should exists with NULL value. If it has a number it will be number instead.

[{ "MyField": null, "MyOtherField": "Dummy" },{ "MyField": 34, "MyOtherField": "Some Value" }]

There is a column in a table that NULL value has a special meaning on an existing Desktop software (I am not the developer). Same behavior wanted for mobile app and mobile app has MARS as middleware for reading values. I am developer for Mobile and MARS. Basically this is my reasoning.

What I am looking for is both on the server side and client side. TDataSet will be a result for a function on server so a select result of a query would be directly returned. Received data on mobile will be accordingly assigned NULL values for relevant records when converted into a memory table using MARS client components.

Thanks & Regards,
Ertan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants