I want to use eclipse and java to make a program that can parse json files in java only.
For example, I want to change a value in JSON to another value every second.
I know the jsonparse function in javascript, but to carry it over through scriptengine alone seems like a bad solution.
I also know that I can use Apache IO to read a file to string and then edit the string and read the file back, but it doesn't seem efficient.
Is there an effective way to modify values in a JSON.php file?
Here is a JSON.php file that I have.
[{"color": "red waves-effect waves-light", "value": "0", "activator": "null"}]
Here is a part of my java program that does the text editing.
String attentionVs = "" + attentionV;
File fileattentionV = new File("attentionV.php");
String fileContext2 = FileUtils.readFileToString(fileattentionV);
fileContext2 = attentionVs;
FileUtils.write(fileattentionV, fileContext2);
String meditationVs = "" + meditationV;
File filemeditationV = new File("meditationV.php");
fileContext2 = FileUtils.readFileToString(filemeditationV);
fileContext2 = meditationVs;
FileUtils.write(filemeditationV, fileContext2);
Thanks for your help!