Reads data from a node as a JSON object.

@param path
@return
@since 0.3.1
@throws ZooKeeperException
540305
public Object getDataJson(String path) throws ZooKeeperException {
        try {
            Object data = getFromCache(cacheNameJson, path);
            if (data == null) {
                data = _readJson(path);
                putToCache(cacheNameJson, path, data);
            }
            return data;
        } catch (ZooKeeperException.NodeNotFoundException e) {
            return null;
        } catch (Exception e) {
            if (e instanceof ZooKeeperException) {
                throw (ZooKeeperException) e;
            } else {
                throw new ZooKeeperException(e);
            }
        }
    }
1237099
public String getData(String path) throws ZooKeeperException {
        byte[] data = getDataRaw(path);
        return data != null ? new String(data, UTF8) : null;
    }
300838
public XMLResource xml(JSONPathQuery path) throws Exception {
		Object jsonValue = path.eval(this);
		return xml(jsonValue.toString());
	}
820034
private String read(String path) throws IOException {
        StringBuffer sb = new StringBuffer();
        String tempStr;
        File file = new File(path);
        // 如果文件不存在，读取失败
        if (!file.exists()) throw new FileNotFoundException();
        FileInputStream fis = new FileInputStream(file);
        BufferedReader br = new BufferedReader(new InputStreamReader(fis));
        while ((tempStr = br.readLine()) != null) sb.append(tempStr);
        return sb.toString();
    }
605833
function readJSON(path) {
  return new Promise(function ($return, $error) {
    var file, parsed;
    return Promise.resolve(read(path)).then(function ($await_1) {
      try {
        file = $await_1;
        parsed = JSON.parse(file);
        return $return(parsed);
      } catch ($boundEx) {
        return $error($boundEx);
      }
    }.bind(this), $error);
  }.bind(this));
}
391515
public String[] getChildren(String path) throws ZooKeeperException {
        try {
            List<String> result = curatorFramework.getChildren().forPath(path);
            return result != null ? result.toArray(ArrayUtils.EMPTY_STRING_ARRAY) : null;
        } catch (KeeperException.NoNodeException e) {
            return null;
        } catch (Exception e) {
            if (e instanceof ZooKeeperException) {
                throw (ZooKeeperException) e;
            } else {
                throw new ZooKeeperException(e);
            }
        }
    }
1062927
def read_json_file(cls, path):
        
        with open(path, 'r') as f:
            return cls.from_dict(json.load(f))
85759
public static GridCoverage2D readRaster( String path ) throws Exception {
        OmsRasterReader reader = new OmsRasterReader();
        reader.file = path;
        reader.process();
        GridCoverage2D geodata = reader.outRaster;
        return geodata;
    }
492106
function readDB(path)
{
    return readFileAsync(path)
        .then((jsonStr) =>
        {
            try
            {
                return JSON.parse(jsonStr);
            }
            catch(ex)
            {
                // Wrap the exception in a more friendly one.
                const error = new Error("Failed to parse on disk json file.");
                error.code = 'ERR_JSON_PARSE';
                error.innerException = ex;

                // Throw the error
                throw error;
            } // end try/catch
        });
}
974704
@SuppressWarnings("unchecked")
    public Map<String, Object> downloadPayload(String path) {
        try (InputStream inputStream = externalPayloadStorage.download(path)) {
            return objectMapper.readValue(IOUtils.toString(inputStream), Map.class);
        } catch (IOException e) {
            logger.error("Unable to download payload from external storage path: {}", path, e);
            throw new ApplicationException(ApplicationException.Code.INTERNAL_ERROR, e);
        }
    }
184468
function readJson(filePath) {
    var json = {};

    try {
        var content = fs.readFileSync(path.resolve(process.cwd(), filePath), {
            encoding: 'utf-8'
        });
        json = JSON.parse(stripJsonComments(content));
    } catch (error) {
        console.error(error);
    }

    return json;
}
1015512
private static BufferedReader open(final String path) throws IOException {
    if (path.equals("-")) {
      return new BufferedReader(new InputStreamReader(System.in));
    }

    InputStream is = new FileInputStream(path);
    if (path.endsWith(".gz")) {
      is = new GZIPInputStream(is);
    }
    // I <3 Java's IO library.
    return new BufferedReader(new InputStreamReader(is));
  }
999017
public static SimpleFeatureCollection readJsonfile( String path ) throws Exception {

        OmsJsonFeatureReader reader = new OmsJsonFeatureReader();
        reader.file = path;
        reader.readFeatureCollection();

        return reader.geodata;
    }
514763
public byte[] getData(String path, Stat stat, Watcher watcher)
    throws KeeperException.NoNodeException {
        return dataTree.getData(path, stat, watcher);
    }
736962
public boolean setData(String path, String value, boolean createNodes)
            throws ZooKeeperException {
        return _write(path, value != null ? value.getBytes(UTF8) : null, createNodes);
    }
712037
private Map<String, ZkDisconfData> getDisconfData(String path) throws KeeperException, InterruptedException {

        Map<String, ZkDisconfData> ret = new HashMap<String, ZkDisconfData>();

        ZookeeperMgr zooKeeperMgr = ZookeeperMgr.getInstance();
        ZooKeeper zooKeeper = zooKeeperMgr.getZk();

        if (zooKeeper.exists(path, false) == null) {
            return ret;
        }

        List<String> children = zooKeeper.getChildren(path, false);
        for (String firstKey : children) {

            ZkDisconfData zkDisconfData = getDisconfData(path, firstKey, zooKeeper);
            if (zkDisconfData != null) {
                ret.put(firstKey, zkDisconfData);
            }
        }

        return ret;
    }
1244282
def load_json_file_contents(path: str) -> str:
    
    assert isinstance(path, str)
    content = None

    file_path = os.path.abspath(path)
    content = fileutils.read_text_from_file(file_path)
    json_object = json.loads(content)
    content = json.dumps(json_object, sort_keys=True, indent=4)

    return content