Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Annotation not converting results to JSON  RSS feed

 
John Morgan
Ranch Hand
Posts: 176
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?
 
Ron McLeod
Saloon Keeper
Posts: 2590
327
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a Jackson dependency?
 
John Morgan
Ranch Hand
Posts: 176
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Added that in, and still not change.  
 
John Morgan
Ranch Hand
Posts: 176
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
Saloon Keeper
Posts: 2590
327
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • 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: 176
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
Saloon Keeper
Posts: 2590
327
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • 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: 176
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.
 
The fastest and most reliable components of any system are those that are not there. Tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!