What to do with this?

  String contents = readFileAsString(file);

You need to pass it to the function where you are reading the file and mapping the json to a variable.