[solved] saving json files and replacing images.

Hi!

working on a new app now and come across a couple of problems Im hoping someone can help me with. also made a post about some camera issus I have in case I have overlooked something there:

http://developer.anscamobile.com/forum/2012/04/16/camera-functionality

  1. Saving json files:

I use json files to load up tables and they are great for that. Easy to use and set up.
Problem I got was when I was saving one of them inside the app to update some information.

say I have this in a json file:

{ 1:200, 2:“b”, 3:“G”, 4:4, 5:5, 6:6, 7:7}

now if I save that file it looks like this afterwards:

{“1”:200,“2”:“b”,“3”:“G”,“4”:4,“5”:5,“6”:6,“7”:7}

so now my numbers have turned into strings and I dont want that. My files are abit more complex than this as well else I could have just converted it easy enough. Basically I want it to save the table exactly like I have it in corona. Anyone know how I can do this with json?
2. Im using the camera to take some photos and would like the user to be able to replace an existing image with a new one. Now the file gets overwritten and all, but seems corona still keeps the old image in memory? Is there a way to clear that instance? Seems to be replace when the game is reloaded but thats not so userfriendly :slight_smile: I admit I havent worked to hard on that yet cause I just started on that part so will keep looking. But if anyone has a answere it would be great :slight_smile:
Thanks!

Edited:

Found the answere myself after searching abit.
for the json problem it seems that values put inbetween {} gets set as strings but between [] gets set as an array so I could create a easy workaround for my problem.

so the example I made: { 1:200, 2:“b”, 3:“G”, 4:4, 5:5, 6:6, 7:7}
will have to be typed in like: [200, “b”, “G”, 4, 5, 6, 7] in the json file.

And for the replaceing a saved file and reloading it Im not sure why I thought it was I problem. Think I have read it somewhere but after som testing it dosnt seem to be a problem so its all good :slight_smile:
[import]uid: 17969 topic_id: 24974 reply_id: 324974[/import]