You are running into a couple of basic programming issues.
Lua, like most languages can only open, read, write, append to and close flat files. They can be text/ASCII or binary. A couple of languages have JSON parsing built in, others come from installed libraries. Corona includes the JSON library, which you can simply require in any module where you plan to use it:
local json = require("json")
And you will get two simple functions:
local someJSONEncodedString = json.encode( someLuaTable )
returns a JSON encoded/serialized string and stores it in a variable. It’s twin, is the json.decode function:
local someLuaTable = json.decode( someJSONEncodedString )
returns a Lua table from the JSON string. Then you can write that encoded string to a Lua file. You can open, read, and then json.decode() a string you read from a Lua file and voila! you have a Lua table.
As far as accessing this, Corona’s history is around Mobile apps, so many of the file IO rules come from those enforced by mobile device rules. This means working within the app’s sandbox. Desktop apps are moving towards this model.
You can access the sandbox files as mentioned above. You can also include files in your system.ResourceDirectory (i.e. the folder with main.lua) since you’re developing apps there, but they will be read-only and there are additional restrictions on Android. But if you want to read/write to this file, you will have to detect the first time the app runs (file doesn’t exist in system.DocumentsDirectory for instance) and copy your starter file there inside your app.
We did a tutorial on copying an SQLite database from system.ResourcesDirector to system.DocumentsDirectory here:
https://coronalabs.com/blog/2015/05/19/tutorial-initializing-a-writable-sqlite-database-from-a-read-only-database/
It however will work for any file.
Lua tables and XML are not all that friendly. JSON is pretty much just key-value pairs. XML not only has key-values (tag, contents inside the tags), but it has attributes:
\<sometag someattribute="somevalue"\>some data\</sometag\>
This doesn’t map well to Lua tables. We have an unsupported XML.lua file that an engineer back in 2012 put together, but he has long since moved on. It works for most XML. You can get it here:
https://github.com/coronalabs-samples/business-app-sample
And there is an rss.lua module that uses the xml.lua module. It will likely work for you, but JSON is just so much nicer.
Finally, our network.request() API can be used to get/fetch JSON from web servers. This is another way to get content in your app.
Rob