cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cesar Agustin Garcia Vazquez (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-12760) SELECT JSON "firstName" FROM ... results in {"\"firstName\"": "Bill"}
Date Mon, 29 Jan 2018 05:33:00 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-12760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16342915#comment-16342915
] 

Cesar Agustin Garcia Vazquez commented on CASSANDRA-12760:
----------------------------------------------------------

[~niek] changing this behavior would break existing code relying on this feature as is. We
could add a new option like 
select plain_json * from user;
which would have this expected behavior.

> SELECT JSON "firstName" FROM ... results in {"\"firstName\"": "Bill"}
> ---------------------------------------------------------------------
>
>                 Key: CASSANDRA-12760
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12760
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>         Environment: Cassandra 3.7
>            Reporter: Niek Bartholomeus
>            Assignee: Shivang Nagaria
>            Priority: Major
>              Labels: lhf
>
> I'm using Cassandra to store data coming from Spark and intended for being consumed by
a javascript front end.
> To avoid unnecessary field name mappings I have decided to use mixed case fields in Cassandra.
I also happily leave it to Cassandra to jsonify the data (using SELECT JSON ...) so my scala/play
web server can send the results from Cassandra straight through to the front end.
> I noticed however that all mixed case fields (that were created with quotes as Cassandra
demands) end up having a double set of quotes
> {code}
> create table user(id text PRIMARY KEY, "firstName" text);
> insert into user(id, "firstName") values ('b', 'Bill');
> select json * from user;
>  [json]
> --------------------------------------
>  {"id": "b", "\"firstName\"": "Bill"}
> {code}
> Ideally that would be:
> {code}
>  [json]
> --------------------------------------
>  {"id": "b", "firstName": "Bill"}
> {code}
> I worked around it for now by removing all "\""'s before sending the json to the front
end.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message