writing json data to file is working