0

I need to use bundled json in my application.So i added my json file under assets folder.How to write code for using this ?Please help...

1 Answer 1

2

you first need to read your json from asset folder

    InputStream is = appContext.getAssets().open("myJson.json");
int size = is.available();
buffer = new byte[size];
is.read(buffer);
is.close();
String bufferString = new String(buffer);

and then you can do

JSONObject obj = new JSONObject(bufferString);

and now obj contain your json.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.