Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Converting the Database details to JSON object

 
rambabu desina
Ranch Hand
Posts: 42
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ranchers,

In my project there is a need to get the database details using ajax call.in this scenario , where i have to convert the database details to JSON i.e., in Controller or Dao class .

thanks and regards
Ram.
 
Vishal Shaw
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Technically speaking, you haven't even asked a question.

I assume you want to know how to do it. In that case, why don't you do some search before posting such a dumb question. Try out a solution (I still remember there's a jar named json.jar for that). Then if you face a problem, post it
 
E Armitage
Rancher
Posts: 989
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rambabu desina wrote:Dear Ranchers,

..where i have to convert the database details to JSON i.e., in Controller or Dao class .
...


If you do this in the DAO then it means everyone that uses your DAO needs to understand JSON.
This is increasingly being viewed as not being a problem these days but it seems to make an early decision unnecessarily.
I'd still create a pure Java DAO and make my controllers call utility .toJSON and fromJSON methods.
 
Wendy Gibbons
Bartender
Posts: 1110
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
E Armitage wrote:
rambabu desina wrote:Dear Ranchers,

..where i have to convert the database details to JSON i.e., in Controller or Dao class .
...


If you do this in the DAO then it means everyone that uses your DAO needs to understand JSON.
This is increasingly being viewed as not being a problem these days but it seems to make an early decision unnecessarily.
I'd still create a pure Java DAO and make my controllers call utility .toJSON and fromJSON methods.


not if he makes 2 methods on the DOA getAsObject and getAsJson
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic