Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMahmoud Faour
202 PointsParsing JSON in Android using AsyncHttpClient
I have got a server with some JSON files, here is the link for example: “http://mahmoudfa-001-site1.atempurl.com/appetizers.json” it has 1 of the files. so what i have done is that i connected to the server with this code : AsyncHttpClient client1 = new AsyncHttpClient(); client1.get("http://mahmoudfa-001-site1.atempurl.com/appetizers.json", new TextHttpResponseHandler() { @Override public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { } @Override public void onSuccess(int statusCode, Header[] headers, String responseString) { }); } like that I’m connected so what i have to do is writing the code on “onSuccess” function, but the problem is idk what code to use to parse the JSON into my textviews. can you guys please help me out?
1 Answer
Seth Kroger
56,413 PointsThere are both a built-in JSON parsing and 3rd-party libraries such as GSON and Jackson.