-
Notifications
You must be signed in to change notification settings - Fork 28
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
Empty strings in version 0.1.15, is converted to null #58
Comments
Glad you like the library, would love to know what you think is funky. (some things I know about and are a language limitation 👎 ) As far as this issue is concerned, I'm not sure I understand your use case. Are you saying that deserializing an emptystring to json should results in {} and doesn't? can you provide a code sample? |
Thanks for your response. No an empty string '' should still be an empty string '' when it is deserialized. Actually none of the versions give what I would consider as the correct result. Here is an example that illustrates the issue: The Class:
The code:
(The JSON.stringify is just to have a result that is easy to copy/paste here) Version 0.1.14 Output:
Version 0.1.15 Output:
Expected Output:
The only way that I can trigger the "expected result" (in both versions) is to change the uuid attribute in the Test class to be like this: But using the simple deserialize removes the check for type, which is not ideal. |
Ah ok, I see what you mean. I'll take a look at this though I'm traveling for the next few days so may not find the time until next week. |
Hello,
I have been using cerialize for a while, and I am generally very satisfied. It does have some funky behaviors that you will have to learn to use it in more advanced cases, but it is not that problematic.
However, after the latest update (0.1.15) an empty JSON string ("") is deserialized into null, which for me is a big problem. I will now have to go through my objects manually to change this back to empty string. Meaning that the value gained from using the library seems to disappear.
My solution for now is to roll back to the version 0.1.14, which also means rolling back my typescript version.
I hope that you can help me, and maybe release a new version that fixes this, or at least makes it as an option or similar.
The text was updated successfully, but these errors were encountered: