Hi,
I try to read file .json in html5 change value save it and reload browser, it work fine in PC browser and android browser all value saved and loaded fine but in ios browser it not saved.
try code below
local json = require( "json" ); local database = { } local path = system.pathForFile( "test.json", system.DocumentsDirectory ); local function save( contents ) local file = io.open( path, "w" ); if file then local contents = json.encode( contents ); file:write( contents ); io.close( file ); return true; else return false; end end local function load( ) local myTable = { } local file = io.open( path, "r" ) if file then -- read all contents of file into a string local contents = file:read( "\*a" ); myTable = json.decode( contents ); io.close( file ); return myTable; end end local file = io.open( path, "r" ); if file == nil then print( "create file" ) local contents = { }; contents.isBool = true; if( save( contents )) then local newContents = load( ); print( "Value isBool", newContents.isBool ) -- Change value to false timer.performWithDelay( 1000, function( ) newContents.isBool = false; print( "Change value isBool", newContents.isBool ) save( newContents ); end, 1 ); end else io.close( file ); print( "Load data", load( ).isBool ); end