Currently, I am attempting to input new data into an existing JSON file using text input. In my project using React Native, I have a JSON file named PartyInfo.json where certain data is stored. The goal is to have this data passed from a form and saved in PartyInfo.json.
const PartyInfo = require('../PartyInfo.json');
let party = {
name: this.state.name,
info: this.state.info,
date: this.state.date,
price: this.state.price,
};
let data = JSON.stringify(party);
PartyInfo.writeFile('PartyInfo.json', data);
Despite attempting various solutions found in similar questions, none have been successful. Any help would be greatly appreciated.