/*
Reads in a file to a string, and parses it into an icu-formatted
JSON object.
494964
function (domain, path, callback) {
        var pofile = fs.readFileSync(path, 'utf8');
        var icuObject = this.poStringToICUSync(domain, pofile);
        callback(null, icuObject);
    }
764588
def json_decode_file(filename):
    
    seq = open(filename).read()
    # The JSON standard has no comments syntax. We have to remove them
    # before feeding python's JSON parser
    seq = json_remove_comments(seq)
    # Parse all the unicode stuff to utf-8
    return json_unicode_to_utf8(json.loads(seq))
926032
@Override
    protected Asset readJson(final String assetId) throws IOException, BadVersionException {
        FileInputStream fis = null;
        try {
            fis = DirectoryUtils.createFileInputStream(createFromRelative(assetId + ".json"));
            Asset ass = processJSON(fis);
            return ass;
        } finally {
            if (fis != null) {
                fis.close();
            }
        }
    }
142222
function rJson(path, callback) {

    if (typeof callback === "function") {
        Fs.readFile(path, "utf-8", function (err, data) {
            try {
                data = JSON.parse(data);
            } catch (e) {
                err = err || e;
            }
            callback(err, data);
        });
        return;
    }

    return JSON.parse(Fs.readFileSync(path));
}
585829
function parseJSON( path, content ) {

            return JSON.parse( content, function( key, value ) {

                if ( options.stripComments && key === "{{comment}}" ) return undefined;

                // Replace variables in their values

                if ( Object.keys( options.variables ).length && typeof value === "string" ) {
                    value = replaceVariables( value );
                }

                var match = ( typeof value === "string" ) ? value.match( options.parsePattern ) : null;

                if ( match ) {
                    var folderPath = getFolder( path ) || ".";
                    var fullPath = folderPath + "/" + match[ 1 ];

                    return isDirectory( fullPath ) ? parseDirectory( fullPath ) : parseFile( fullPath );
                }

                return value;

            } );
        }
433432
def read_json(self):
        
        line = self.stdin.readline()
        if line == '':
            raise EOFError()
        return json.loads(line)
549944
private Object convertFile(Object name) throws IOException, JSONException{
    if (name instanceof String) {
      String file = (String) name;
      JSONObject json = getJsonConfig(file);
      if (json!=null) {
        return json;
      }
    } else if (name instanceof Path) {
        Path file = (Path)name;
        JSONObject json = getJsonConfig(file);
        if (json != null) {
          return json;
        }
    } 
    return name;
  }
396488
function read(fp, opts, fn) {
  opts = opts || {};
  opts.encoding = opts.encoding || 'utf8';

  if (opts.read) {
    return opts.read(fp, opts);
  } else if (fn) {
    return fn(fp, opts);
  }

  if (endsWith(fp, '.js')) {
    return tryRequire(fp);
  } else {
    var str = tryCatch(fs.readFileSync, fp, opts);
    if (endsWith(fp, '.json')) {
      return tryCatch(JSON.parse, str);
    }
    return str;
  }
}
931272
def parse_file(self, sourcepath):
        """"""

        # Open input file and read JSON array:
        with open(sourcepath, 'r') as logfile:
            jsonstr = logfile.read()

        # Set our attributes for this entry and add it to data.entries:
        data = {}
        data['entries'] = json.loads(jsonstr)
        if self.tzone:
            for e in data['entries']:
                e['tzone'] = self.tzone

        # Return the parsed data
        return data
485925
def _read_from_json(self, file):
        

        try:
            with io.open(os.path.join(self._PATH, file), encoding="utf8") as f:
                return {u["id"]: u for u in json.load(f)}
        except IOError:
            return {}
364434
private String readFileIntoString(String fileName,  InputStream is) throws IOException {
        FileInputStream stream = null;
        InputStreamReader reader = null;
        try {
            if (is != null) {
                reader = new InputStreamReader(is, charset);
            } else {
                stream = new FileInputStream(fileName);
                reader = new InputStreamReader(stream, charset);
            }
            
            return readStreamIntoString(reader);
        } finally {
            if (reader != null) {
                reader.close();
            }
            if (stream != null) {
                stream.close();
            }
        }
    }
579202
def parse(string, is_file=False, obj=False):
        
        try:
            if obj is False:
                if is_file:
                    return system_json.load(string)
                return system_json.loads(string, encoding='utf8')
            else:
                if is_file:
                    return system_json.load(
                        string,
                        object_hook=lambda d: namedtuple('j', d.keys())
                        (*d.values()), ensure_ascii=False, encoding='utf8')
                return system_json.loads(
                    string,
                    object_hook=lambda d: namedtuple('j', d.keys())
                    (*d.values()), encoding='utf8')
        except (Exception, BaseException) as error:
            try:
                if current_app.config['DEBUG']:
                    raise error
            except RuntimeError as flask_error:
                raise error
            return None
231912
function toJSON (str) {
  str = str.toString();
  try {
    return JSON.parse(str);
  } catch (e) {
    throw new Error(
      'The "toJSON" helper must be passed a valid JSON string.'
    );
  }
}
644403
public JSON readFromFile( File file ) {
      if( file == null ){
         throw new JSONException( "File is null" );
      }
      if( !file.canRead() ){
         throw new JSONException( "Can't read input file" );
      }
      if( file.isDirectory() ){
         throw new JSONException( "File is a directory" );
      }
      try{
         return readFromStream( new FileInputStream( file ) );
      }catch( IOException ioe ){
         throw new JSONException( ioe );
      }
   }
547882
@SuppressWarnings({"unchecked"})
    public <T> T read(File jsonFile) throws IOException {
        return read(jsonFile, Configuration.defaultConfiguration());
    }
198042
def read_file
      json_string = ''
      if ApiExplorer::use_file
        json_path = ApiExplorer::json_path
        json_string = File.read(json_path)
      else
        json_string = ApiExplorer::json_string
      end
       
      @methods = JSON.parse(json_string)["methods"]
    end
1141899
@Override
    protected T readCacheDataFromFile(File file) throws CacheLoadingException {
        try {
            JsonParser jsonParser = jsonFactory.createJsonParser(new FileReader(file));
            T result = jsonParser.parse(getHandledClass(), null);
            jsonParser.close();
            return result;
        } catch (FileNotFoundException e) {
            // Should not occur (we test before if file exists)
            // Do not throw, file is not cached
            Ln.w("file " + file.getAbsolutePath() + " does not exists", e);
            return null;
        } catch (Exception e) {
            throw new CacheLoadingException(e);
        }
    }