我有一列文本類型應包含JSON值。如何解析cassandra中文本列的JSON值
{
"customer": [
{
"details": {
"customer1": {
"name": "john",
"addresses": {
"address1": {
"line1": "xyz",
"line2": "pqr"
},
"address2": {
"line1": "abc",
"line2": "efg"
}
}
}
"customer2": {
"name": "robin",
"addresses": {
"address1": null
}
}
}
}
]
}
如何提取查詢的'address1'列的JSON字段?
首先我想獲取JSON值,然後我將解析。
SELECT JSON customer from text_column;
用我的查詢,我得到以下錯誤。
com.datastax.driver.core.exceptions.SyntaxError: line 1:12 no viable alternative at input 'customer' (SELECT [JSON] customer...)
com.datastax.driver.core.exceptions.SyntaxError: line 1:12 no viable alternative at input 'customer' (SELECT [JSON] customer...)
卡桑德拉版本2.1.13
向我們展示您的表架構 –
在Cassandra 2.2中添加了JSON查詢支持。在運行2.1.13時,必須升級才能訪問此功能:http://www.datastax.com/dev/blog/whats-new-in-cassandra-2-2-json-support – Aaron