saves data in JSON format