SELECT JSON

The SELECT statement has also been extended to support retrieval of rows in a JSON-encoded map format. The results for SELECT JSON will only include a single column named [json]. This column will contain the same JSON-encoded map representation of a row that is used for INSERT JSON.

Let us try to fetch all status updates that were made by alice after the date 2016-11-20 in JSON format:

SELECT JSON * FROM "user_status_updates_by_datetime"WHERE "username" = 'alice'AND status_date > '2016-11-20';

You will get each CQL row as a separate JSON-encoded string:

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.