Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EB51A6BF5 for ; Thu, 16 Jun 2011 08:58:28 +0000 (UTC) Received: (qmail 64378 invoked by uid 500); 16 Jun 2011 08:58:26 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 64353 invoked by uid 500); 16 Jun 2011 08:58:26 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 64345 invoked by uid 99); 16 Jun 2011 08:58:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jun 2011 08:58:26 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [62.80.2.197] (HELO mail.berlin01.toptarif.de) (62.80.2.197) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jun 2011 08:58:21 +0000 Received: from [192.168.68.246] (unknown [192.168.68.246]) by mail.berlin01.toptarif.de (Postfix) with ESMTP id 7718DECA92 for ; Thu, 16 Jun 2011 10:57:58 +0200 (CEST) Message-ID: <4DF9C596.3020400@toptarif.de> Date: Thu, 16 Jun 2011 10:57:58 +0200 From: Timo Nentwig User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: user@cassandra.apache.org Subject: Re: sstable2json2sstable bug with json data stored References: <4DF8D2C2.1020808@toptarif.de> <4DF9B58D.1060108@toptarif.de> <4DF9BAF3.4010306@toptarif.de> In-Reply-To: <4DF9BAF3.4010306@toptarif.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 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 >