aspose file tools*
The moose likes Servlets and the fly likes Converting the Database details to JSON object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Converting the Database details to JSON object" Watch "Converting the Database details to JSON object" New topic
Author

Converting the Database details to JSON object

rambabu desina
Ranch Hand

Joined: May 26, 2012
Posts: 35

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

Joined: Aug 09, 2012
Posts: 179
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


Programming is about thinking, NOT coding
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 761
    
    9
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

Joined: Oct 21, 2008
Posts: 1106

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting the Database details to JSON object
 
Similar Threads
i want to create a file in the server from the client? is it possible?
Build Array in Servlet And Pass Back to Ajax Callback
Retrieving array from database
How to read + operator using javascript
Sending Javascript from server to execute on client side.