我发出以下请求:
curl --http2 -X "POST" "http://localhost:8088/query-stream"
-H "Content-Type: application/vnd.ksql.v1+json; charset=utf-8"
-d $'{
"sql": "SELECT * FROM USERS EMIT CHANGES;",
"streamsProperties": {
"ksql.streams.auto.offset.reset": "earliest"
}
}
我得到的结果是:
{"queryId":"cdfb3ccc-0ab5-4186-a249-b279bfc09587","columnNames":["USERID","NAME"],"columnTypes":["STRING","STRING"]}
["1","Max"]
["2","Alex"]
["13","Andrew"]
...
有没有一种方法可以获得json格式的数据?
{"userid":"1","name":"Max"}
{"userid":"2","name":"Alex"}
{"userid":"13","name":"Andrew"}
如果poco对象是json格式的,那么将这些数据反序列化为poco对象比解析“row”格式更容易。
1条答案
按热度按时间6tqwzwtp1#
根据文档,您可以设置
Accept
标题。它默认为application/vnd.ksqlapi.delimited.v1
但也可以设置为application/json
: