GSON to Fetch/Parse JSON in Android

This tutorial will cover how to fetch JSON from assets folder and parse it. We will use GSON, a JSON parsing library developed by Google, to quickly parse the JSON into Java objects with very minimal work required.

JSON structure in assets folder

 

Keep the “food_menu.json” file in the assets folder

json
Json file in assets folder

 

Main Activity

 

Manifest and Activity Entry

 

Model class which is Serialized

 

GSON and it’s API

 

Output

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *