I want to fetch the json data from web api, I was previously using Retrofit for that, but I don't wanna use any third party library.
I know I can use HttpURLConnection or HttpClient but there is no proper post for that and they are too old, and in some post they were telling that it is deprecated, so if you have any other solution using HttpUrlConnection and HttpClient or without using that then please let me know.
And please tell me how to parse that data cause before that I was using GSONParser library for that.
Here is my example api:
Hey you can retrieve your data using your methods, that depends on you. For example, I have never used a third party library to retrieve data from the server.
Think about this: a class that I can name
FileContentReaderwith a methodgetContentFromUrlthis will fetch your JSON data as string that you can then parse usingJSONObjectorJSONArrayaccording to your file structure.You can use the code this way inside an asynchronous task or any background task :