function out = readjson (in, f="fromJSON")

  fid = fopen (in, "r");
  js = fread (fid, Inf, "*char")';
  fclose (fid);
  if (strncmpi (f, "f", 1))
    out = fromJSON (js);
  else
    out = jsondecode (js);
  endif

endfunction

