On 6/16/11 10:12, Timo Nentwig wrote:
On 6/16/11 10:06, Sasha Dolgy wrote:
The JSON you are showing below is an export from cassandra?

Yes. Just posted the solution:
https://issues.apache.org/jira/browse/CASSANDRA-2780?focusedCommentId=13050274&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13050274

Guess this could simply be done in the quote() method.

Hm, is this the way it's supposed to be?

[default@foo] set transactions[test][data]='{"foo":"bar"}';
Value inserted.
[default@foo] get transactions[test][data];
=> (column=data, value={"foo":"bar"}, timestamp=1308214517443000)
[default@foo] set transactions[test][data]='{\"foo\":"bar"}';
Value inserted.
[default@foo] get transactions[test][data];
=> (column=data, value={"foo":"bar"}, timestamp=1308214532484000)


Otherwise here's a regex that cares about existing backslashes:

    private static String quote(final String val)
    {
        return String.format("\"%s\"", val.replaceAll("(?<!\\\\)\"", "\\\""));
    }

{ "74657374": [["data", "{"foo":"bar"}", 1308209845388000]] }

Does this work?

{
74657374: [["data", {foo:"bar"}, 1308209845388000]]
}

-sd

On Thu, Jun 16, 2011 at 9:49 AM, Timo Nentwig<timo.nent...@toptarif.de> wrote:
On 6/15/11 17:41, Timo Nentwig wrote:

(json can likely be boiled down even more...)

Any JSON (well, probably anything with quotes...) breaks it:

{
"74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
}

[default@foo] set transactions[test][data]='{"foo":"bar"}';

I feared that storing data in a readable fashion would be a fateful idea.

https://issues.apache.org/jira/browse/CASSANDRA-2780


Reply via email to