-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support deserializing [] as null or empty collection when the java type is a not an object #540
Comments
So, would it be correct to say that for
should behave as a special case that would be equivalent to
If so, this could make sense, and could perhaps be added as a feature like, say, |
Maps and pojos are expected to be represented as objects in JSON. But in case they are empty, PHP may say [] So, yes, the proposed option makes sense :) |
For collection objects that would already work. I guess use of I loathe PHP. This kind of nonsense reminds me of why. |
Do you think it could be supported in v2.5? |
@fabienrenaud Yes I think so; I think that this is both high priority and reasonable to implement. But if latter turns out to be false I will add an update. So, yes, I hope to get this in by 2.5. |
Turns out it was quite easy, so it's done. |
Awesome :) |
2.5.0 has not been released, and there is no date set for starting with release candidates. So I think it will take a while. But perhaps it could get released in October. |
In PHP, it is possible to associate arrays. Those associates arrays can then be json encoded and turn to be JSON objects.
But when the associate array is empty, for various processing reasons, json_encode won't be able to tell that this particular empty associate array is an object, so it encodes it as [].
Then all hell breaks in Java because deserialize [] into a non array class doesn't work.
Task: Support that such as it deserialize to null when the java type is an non array object, and as empty collection when the java type is a collection.
The text was updated successfully, but these errors were encountered: