Ayo Seun Solomon
2 min readAug 12, 2021

How to read JSON file from App Storage in Android using Android studio Kotlin

Json is a lightweight format for storing data, I mean , you could store a whole textbook as a json file and it wouldn’t weight 1mb.

Major servers store their data as Json and data sent over APIs are best served in Json because of it’s lightweight, so let’s see how to use Json in our App, that is how to read Data from a Json array and display them in our App.

First create a file and name it “anything. Json” , where anything is your file name, like maybe score.json, now open this file with any text editor and create a curly bracket {}, in the bracket and write “data” and place it inside a quote, so your score.json now looks like this

{

“data”

}

Next add colon next to the data with quotes and add a square bracket, adding a square bracket in json is creating an array where we can add objects to it, so far we are with this

{

“data” : [

]

}

Inside our curly bracket we now add this

{“player” : “Solomon”,

“role”: “ forward “,

“score” : 45

}

The value before the colon is called a key, it’s like a box where the value after the colon is stored,only that it isn’t stored there but referenced, this means if we want to get Solomon we just need to call player , the comma is used to separate each value with it’s key from others , now put the content of the curly bracket into the square btackets, copy and paste more of it separating them with a comma, so it looks like this

So now we our Json file, don’t forget to save it, now head over to Android studio create a new project, we will create a folder in our app directory where we will put our Json file

Ayo Seun Solomon

Blockchain Engineer, Blockchain Core Developer, Building on Ethereum and Polkadot.