Skip to content

RFE-4650: Single string value primitive array deserialization improvement #5022

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

Conversation

eeren-bm
Copy link
Contributor

@eeren-bm eeren-bm commented Mar 12, 2025

(fixes #4650)

PrimitiveArrayDeserializers to deal with single value primitive when ACCEPT_SINGLE_VALUE_AS_ARRAY is enabled.

…tive when ACCEPT_SINGLE_VALUE_AS_ARRAY is enabled.
@@ -214,7 +214,7 @@ public T deserialize(JsonParser p, DeserializationContext ctxt, T existing) thro
protected T handleNonArray(JsonParser p, DeserializationContext ctxt) throws IOException
{
// Empty String can become null...
if (p.hasToken(JsonToken.VALUE_STRING)) {
if (p.hasToken(JsonToken.VALUE_STRING) && p.getText().isEmpty()) {
return _deserializeFromString(p, ctxt);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eeren-bm Have a look at this method in StdDeserializer... By-passing it will skip lots of potentially necessary processing, including CoercionConfig settings.

But I think we can get this to work by bit more re-factoring. Let me see if I can change it a bit.

@cowtowncoder cowtowncoder merged commit 0e31167 into FasterXML:2.19 Mar 12, 2025
6 checks passed
@cowtowncoder cowtowncoder added the cla-received PR already covered by CLA (optional label) label Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-received PR already covered by CLA (optional label)
Projects
None yet
2 participants