I am building a small app that lists some books using Google book API. when I make a request I got that answer with [ and ". I want to remove them
Asked
Active
Viewed 443 times
0
-
3can you show us the json you are getting? – 007 Dec 26 '18 at 07:18
-
1you can remove them by replacing character while setting data to TextView `Str.replace('[', '') ` you can even use Regex to replace eliminate those characters – Akshay Katariya Dec 26 '18 at 07:19
-
Show your JSON FILe – Rahul Kushwaha Dec 26 '18 at 07:23
-
Follow this URL . Hope this will help you. Url:-https://stackoverflow.com/questions/7552253/how-to-remove-special-characters-from-a-string – Rahul Kushwaha Dec 26 '18 at 07:28
-
here is the json – Mohamed Hamza Dec 26 '18 at 08:07
-
https://www.googleapis.com/books/v1/volumes?q=android&maxResults=1 – Mohamed Hamza Dec 26 '18 at 08:07
2 Answers
1
In the adapter You should replace each character you don't need with space like this:
list.get(i).getName().replace("[","");
For a more specific answer, please post your Jason.
Update: [] in Json is JsonArray and {} is for JsonObject. So you should parse your Jso correctly using Gson or any other library you are using.

Elmira Frhn
- 320
- 4
- 14
-
@MohamedHamza Could you provide the code where you parse the Json? – Elmira Frhn Dec 26 '18 at 12:13
1
As in the JSON that you attached, the object►items►0►volumeInfo►authors is a JsonArray and same for object►items►0►volumeInfo►categories►
So you need to parse authors and categories into an array of Strings and display the first object of the array in your UI

Molly
- 1,887
- 3
- 17
- 34