Xamarin – Parse Json text from SD Card in Android

In this post we would see how to parse a text file which contains JSON text inside it.

Let’s say we have the following JSON text inside the file.


Copy the file to the SD Card using one of the following methods:

  1. Using Eclipse DDMS Tool
  2. Using ADB.EXE
  3. Using WinImage Tool


The following is the layout design, where we have a button and a TextView.


The related resource files are present in the Strings.xml file.


As we are going to parse JSON, we need to add System.Json assembly reference.


Now, first we would get the controls from the layout. Subscribe to the button’s click event.


In the button click event, we would do the following to get the data from the JSON string.


Let’s run the application.


On button click, the file is read from SD Card, and parsed the JSON content and displayed the data.


Hope this helps, thanks for reading.

Full Source Code: Click Here