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.json
the file contains this : `
Now let's write a program that reads the file :
/home/user/file_001.json
and converts its content to a javaJSONObject
."List" is your key because that is the property of the outermost JSON object:
Another solution: