Reputation: 27
this is the string i get from a website
{"Title":"True Grit","Year":"1969","Rated":"G","Released":"11 Jun 1969","Runtime":"2 h 8 min","Genre":"Adventure, Western, Drama","Director":"Henry Hathaway","Writer":"Charles Portis, Marguerite Roberts","Actors":"John Wayne, Kim Darby, Glen Campbell, Jeremy Slate","Plot":"A drunken, hard-nosed U.S. Marshal and a Texas Ranger help a stubborn young woman track down her father's murderer in Indian territory.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTYwNTE3NDYzOV5BMl5BanBnXkFtZTcwNTU5MzY0MQ@@._V1_SX300.jpg","imdbRating":"7.3","imdbVotes":"24,158","imdbID":"tt0065126","Type":"movie","Response":"True"}
How do i remove all this
","
from the string ?
Upvotes: 1
Views: 196
Reputation: 3615
What you probably REALLY want to do is deserialize that JSON string.
Try something like this:
Dim deserializer as New System.Web.Script.Serialization.JavaScriptSerializer()
Dim foo As Object = deserializer.Deserialize(Of Object)(thatString)
Assuming that thatString
is the string you got from that web service. If you want to create a type to match the JSON fields, so much the better. In that case, deserialize it into that type instead of Object.
Upvotes: 2
Reputation: 15813
To replace the three characters "," with a space in a string, you can use this:
s = s.replace(""",""", " ")
You can also remove all the quotes with this:
s = s.replace("""", "")
Upvotes: 2
Reputation: 2830
Use String.Replace
to replace commas with empty strings.
Dim movieData as String = "{""Title"":""True Grit"",""Year"":""1969""}"
movieData = movieData.Replace(",", "")
Upvotes: 1