07-30-2023, 02:09 PM
I am trying to use the datastax java driver and retrieve the row as a JSON.
I do the classic
`SELECT JSON * from myTable WHERE id=1` and this returns a Json formatted string on CQL.
e.g `{ "uuid" : "12324567-...." }`
This works.
Now when, I try to do the same use the Java driver, I use (in scala)
val resultSet = session.execute(queryString)
I pick up one row from this result set using: `"resultSet.one()"`.
This has the string I need, but how do I pick this up?
Experiment: `resultSet.one().getColumnDefinitions.toString`
Prints: `Columns[ [json] (varchar) ]`
Experiment: `resultSet.one().toString()`
<br>
Prints: `Row[{"uuid": "3ce19e07-2280-4b31-9475-992bda608e70"}]` <- String I need
How do I pick up a simple string that represents the JSON in my program, without trying to split the strings above ?
I do the classic
`SELECT JSON * from myTable WHERE id=1` and this returns a Json formatted string on CQL.
e.g `{ "uuid" : "12324567-...." }`
This works.
Now when, I try to do the same use the Java driver, I use (in scala)
val resultSet = session.execute(queryString)
I pick up one row from this result set using: `"resultSet.one()"`.
This has the string I need, but how do I pick this up?
Experiment: `resultSet.one().getColumnDefinitions.toString`
Prints: `Columns[ [json] (varchar) ]`
Experiment: `resultSet.one().toString()`
<br>
Prints: `Row[{"uuid": "3ce19e07-2280-4b31-9475-992bda608e70"}]` <- String I need
How do I pick up a simple string that represents the JSON in my program, without trying to split the strings above ?