-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
MismatchedInputException
for nested repeating element name in List
#393
Comments
I have exactly the same issue. If your XML schema allows it, just try to change the name of one of the clashing names. If you cannot, then I think we need a fix. |
I couldn't find a solution and also my XML schema don't allows change the name, so I switched to DOM4J for deserialization,but It is complicate.A fix is better for me |
Hi,
In that example, I just had to change:
Notice that This is the full example:
Output:
I really hope this can help you somehow. |
MismatchedInputException
: Cannot deserialize instance of java.lang.String out of START_OBJECT token
I hope to look into this soon, but one think I would suggest first is to use a newer version of Jackson: either 2.10.3 or newly released 2.11.0. Both have a few fixes beyond 2.9.10. |
@cowtowncoder: I was using 2.10.2, but can reproduce the same issue on 2.11.0-RC1. |
I can reproduce this, including some simplification. I can also see that if I first serialize structure, output matches input you'd expect (i.e. definition seems correct). |
the produce enviroment can't not change the xml message,so 'the xml you're trying to deserialise 123 must be the first tag.' I can't match this rule.Anyway, thanks a lot |
@kaizenHorse I agree that this should not be necessary, but I think adding that note may be helpful for some users. But this issue should be resolved and I hope to do that once I have time to figure out exact root cause. |
|
Hmmmh. Technically, I think this must be due to low-level detection of "wrapper-less" arrays, which creates virtual wrapper for databind to use. And in this case use of |
MismatchedInputException
: Cannot deserialize instance of java.lang.String out of START_OBJECT tokenMismatchedInputException
for nested repeating element name in List
This issue still seems to be occur on classes that use Jaxb annotations (generated by XJC).
This leads to the same exception as mentioned in this issue: Is there any way of getting this to work? |
@petervandenbroek that is not a complete reproduction of an issue (specifically, input XML is missing) so I can't really say. But couple of notes:
|
@cowtowncoder, I've created new ticket #433 for this problem, since I am able to reproduce it with a simple test. |
I want to deserialize the string contents to Testclass.class on jackson 2.9.10
but I got a Exception: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of
java.lang.String
out of START_OBJECT tokenat [Source: (StringReader); line: 11, column: 7] (through reference chain: saas.mall.supplier.zowoyoo.TestClass["prices"]->saas.mall.supplier.zowoyoo.TestClass$Prices["price"]->java.util.ArrayList[0]->saas.mall.supplier.zowoyoo.TestClass$Price["price"])
The Class that I want to deserialize contains a list of fields with the same name as the fields of the object in the list。
Here is the test case
this is the Class I want to deserialize
PS: if I change the TestClass.Price.price‘s field type from String to Map,it works.like follwing
but when I use a string that contains more objects,
I got a exception:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of
java.util.LinkedHashMap
(although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('4.0')at [Source: (StringReader); line: 11, column: 18] (through reference chain: test.TestClass["prices"]->test.TestClass$Prices["price"]->java.util.ArrayList[1]->test.TestClass$Price["price"])
Hope to provide a solution,TKS
The text was updated successfully, but these errors were encountered: