Hi, is there any way to copy an event.response return value and save it as an .txt/.xml/.json/ or whatever text file extension I want. Thanks in advance
Yes. To save a lua table as json, you need this
http://docs.coronalabs.com/api/library/json/encode.html
… and this
http://docs.coronalabs.com/api/library/io/write.html
Alternatively, this library by SatheeshJM has already done the work for you:
how about if the response is in xml? and I will copy it and save it as an xml file too
The event.response is probably just a string. That string could be full of XML, JSON or any other data format. If you’re getting XML, simply name the file with a .xml extension when you save it.
Rob
oh okay thanks
Yes. To save a lua table as json, you need this
http://docs.coronalabs.com/api/library/json/encode.html
… and this
http://docs.coronalabs.com/api/library/io/write.html
Alternatively, this library by SatheeshJM has already done the work for you:
how about if the response is in xml? and I will copy it and save it as an xml file too
The event.response is probably just a string. That string could be full of XML, JSON or any other data format. If you’re getting XML, simply name the file with a .xml extension when you save it.
Rob
oh okay thanks