How to write into a JSON file via input-box?

step one is file IO

from your idea, the provided record would be like
"this would be the correct answer "

but anyhow basic is

  • read file
  • write file on key [s]
// JSONArray json_a;   ////  json_a = loadJSONArray(infile);   // saveJSONArray(json_a,outfile);
JSONObject json_o;

String infile  = "data/universe.json";
String outfile = "data/universe_answers.json";

void setup() {
  json_o = loadJSONObject(infile);
  println("use:\n [s] to save data to file");
}

void draw() {
}

void keyPressed() {
  if ( key == 's' ) { 
    saveJSONObject(json_o, outfile);
    println("save to "+outfile);
  }
}

seems JSON is very forgiving, it ignored your [TAB]'s and your last [,]


next step
ok question:
what input box you talk about?