How to create a JSONArray from a json file

Updated 18 December 2016

Save

Hello Everyone,

This time while working on creating a list for the recycler view, i tried loading it from a json file which i downloaded from internet.

Approach :

  1. Place your json file in your Assests folder.
  2. Create a string and start adding the contents of your json file into this string.
  3. use this string as argument while declaraing your JSONArray.

See, its really simple.

Let me give you example on how to code this approach and get it working.

Now the Function loadJSONFromAsset();

That’s it !

Now you have got your JSONArray and you can use it simply as per your requirements.

Keep coding and keep sharing. : )

author
. . .

Leave a Comment

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


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home