EDIT: I actually found the answer. I can’t close the question as I am new. I was able to use Array.getString(i) to return the string value needed. Thanks for all the help.
I have JSON like this:
{
"List": [
"example1",
"example2",
"example3",
"example4"
]
}
And I am trying to get the string value of those objects without using a key. How can I do that? The getString() for jsonObject require a key and I don’t have one.
I assume that you have a file :
/home/user/file_001.jsonthe file contains this : `
Now let’s write a program that reads the file :
/home/user/file_001.jsonand converts its content to a java
JSONObject.