Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Annotation not converting results to JSON

 
Ranch Hand
Posts: 195
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working through a maven project and was running some test and found that my Jackson annotations were not converting the results to JSON. I cannot figure out what I am doing wrong.



POM.XML


I do know that I am getting:

resultObject "com.dotComIt.learnWith.vos.UserVO@32f8813f"

What I was expecting to get :

{
"resultObject":
    {"roleID":1,
     "username":"me",
     "userID":1},
"error":false
}


Any suggestions?
 
Sheriff
Posts: 3113
459
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a Jackson dependency?
 
John Morgan
Ranch Hand
Posts: 195
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Added that in, and still not change.  
 
John Morgan
Ranch Hand
Posts: 195
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the complete POM... I did find that the project is using Jersey framework (not something I am familiar with).

 
Ron McLeod
Sheriff
Posts: 3113
459
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

John Morgan wrote:


That looks like a MOXy provider, not Jackson.  


The equivalent Jackson dependency would be:
Disclaimer: I am still learning Maven
 
John Morgan
Ranch Hand
Posts: 195
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Added that to my pom and still not converting to JSON. Not sure what I am doing wrong.
 
Ron McLeod
Sheriff
Posts: 3113
459
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used the pom.xml file that you posted (no changes), added a resource and entity, compiled the project, ran in on TomEE 1.7.0 (Tomcat 8.5), called it from Chrome, and it did return a JSON representation.
 
John Morgan
Ranch Hand
Posts: 195
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you... evidently it is something with my set up then and I will have to look deeper into what could cause it.
 
You learn how to close your eyes and tell yourself "this just isn't really happening to me." Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic