• Post Reply Bookmark Topic Watch Topic
  • New Topic

json ObjectMapper error  RSS feed

 
s ravi chandran
Ranch Hand
Posts: 579
6
Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have an issue with converting json to java bean object.
My bean class is like this:



This is the json string



and this is what I am calling from another class



But I am getting this error:



What I don't understand is why... Please let me know what is the possible issue here...
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The getter and setter are called "getEmailid" and "setEmailid". So, the field name, according to your JSON library, is "emailid", and not "emailId" (note the lower- and upper-case i). Likewise with getUserid, setUserid.

Make sure that the spelling is correct. Either call the methods getEmailId and setEmailId, or call the field "emailid" instead of "emailId" inside the JSON string.
 
s ravi chandran
Ranch Hand
Posts: 579
6
Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:The getter and setter are called "getEmailid" and "setEmailid". So, the field name, according to your JSON library, is "emailid", and not "emailId" (note the lower- and upper-case i). Likewise with getUserid, setUserid.

Make sure that the spelling is correct. Either call the methods getEmailId and setEmailId, or call the field "emailid" instead of "emailId" inside the JSON string.


Ok, got it. Thanks for the reply. The class is an existing one which is used in the whole project. I guess, I can't change it now without impacting other functionality. So, I will handle it from my json string only.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!