This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Strip slashes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Strip slashes" Watch "Strip slashes" New topic
Author

Strip slashes

Emir Bugra Koksalan
Greenhorn

Joined: Aug 23, 2012
Posts: 9

Hello everybody. I'm getting a java object as json by gson package but there is a problem. Gson returns an object like this:



I must convert this like that:



Please help meeee... Thanks..


www.kodmanyagha.org
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37936
    
  22
Welcome to the Ranch

Does that mean you are returned a String containing those backslashes? Have you come across the methods in the String class for replacing characters or substrings?
Emir Bugra Koksalan
Greenhorn

Joined: Aug 23, 2012
Posts: 9

thanks

i found the problem. my variable's type is String and struts adding slashes. I changed the variable type and solved

Thanks for reply.. Have a nice programmings...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37936
    
  22
Well done sorting it out
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Strip slashes
 
Similar Threads
tiles and <sx:autocompleter>
wrestling with json
Undefined on jQuery Ajax Request
json object send to JSF backing bean to xhtml page
Do a form using Struts.