writing json to file