【问题标题】:HBase REST to return json instead of xmlHBase REST 返回 json 而不是 xml
【发布时间】:2016-07-16 04:05:28
【问题描述】:

我正在使用 HBase stargate REST API 从 Hbase 获取数据。我有表 'state' 和行键 '1' 。当我在浏览器中粘贴以下行时,我得到了 xml 格式的输出。

 http://localhost:8000/state/1 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="MQ=="><Cell column="aW5mbzpjb2xvcg==" timestamp="1459193020823">cmVk</Cell><Cell column="aW5mbzpuYW1l" timestamp="1459192932985">TUg=</Cell></Row></CellSet>

如何获取json格式的输出?

提前致谢。

【问题讨论】:

    标签: rest hadoop hbase stargate


    【解决方案1】:

    https://hbase.apache.org/book.html#_using_rest_endpoints

    您可以请求纯文本(默认)、XML 或 JSON 输出,方法是不为纯文本添加标头,或为 XML 添加标头“Accept: text/xml”或为 JSON 添加标头“Accept: application/json”。

    【讨论】:

    • 谢谢 Matias....据我所知,我们可以使用 curl 或 wget 命令来获得预期的输出,但是如果我必须在不使用这些工具的情况下接收 json 数据,即只是修改我的地址..
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-11
    • 2022-01-15
    • 2012-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多