aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Passing Json in a String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Passing Json in a String" Watch "Passing Json in a String" New topic
Author

Passing Json in a String

Tarun Oohri
Ranch Hand

Joined: Feb 20, 2013
Posts: 176
Hi Everyone,
I am trying to use jQuery with servlet to generate dynamic table in the view page. I am using jquery.dataTables.js & jquery.js to generate dynamic table.
In the above String json i am giving fixed data to be shown in the table. But what i want is to get the data from database and pass them here on Runtime. eg: if i want to pass "jhon" instead of "awesome" , how would i "s" reference to it .

Thanks in Advance !!
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30506
    
150

Tarun,
If you can guarantee that the String doesn't have special characters like quotes in it, you can just append it:




If you don't know this, I recommend using a library like Gson to protect you from those characters. Or have a regular expression to strip them out before appending.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Tarun Oohri
Ranch Hand

Joined: Feb 20, 2013
Posts: 176

Thanks a lot Jeanne its working now , just appended it as you showed . Thanks Again!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing Json in a String