cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russell Bradberry <rbradbe...@gmail.com>
Subject Re: INSERT JSON TimeStamp
Date Mon, 28 Sep 2015 20:42:18 GMT
You escape single quotes by doubling them. 

Eg:

  "condition": "BoardStation ==''Lowell'' ",

That is not double quotes arounf ‘lowel’ but in-fact 4 single-quotes, 2 before and 2 after


From:  Ashish Soni
Reply-To:  <user@cassandra.apache.org>
Date:  Monday, September 28, 2015 at 4:32 PM
To:  <user@cassandra.apache.org>
Subject:  Re: INSERT JSON TimeStamp

Thanks a Lot , Also i have single quote in JSON but CQL Doesnt Like it even when i escape
it 
  "condition": "BoardStation =='Lowell' ",

i tried 

  "condition": "BoardStation ==\'Lowell\' ",

INSERT INTO model.RuleSetSchedule JSON ' {
    "ruleSetName": "BOSTONRATES",
    "ruleSetId": "829aa84b-4bba-411f-a4fb-38167a987cda",
    "scheduleId":1,
    "effectiveStartDate": "2015-02-01 00:00:00",
    "effectiveEndDate": "2015-03-01 00:00:00",
    "rules": {
        "1": {
            "condition": "BoardStation =='Lowell' ",
            "action": "FareAmount=9.25",
            "ruleOrder": "1"
        }

    }
}';

On Mon, Sep 28, 2015 at 4:11 PM, Steve Robenalt <srobenalt@highwire.org> wrote:
Hi Ashish,

Most Json parsers expect either a raw long integer value or some version of an iso-8601 date
or timestamp.

See https://en.wikipedia.org/wiki/ISO_8601 for a good reference.

Steve


On Mon, Sep 28, 2015 at 1:08 PM, Russell Bradberry <rbradberry@gmail.com> wrote:
That is not a valid date in CQL, and JSON does not enforce a specific date format.  A correctly
formatted date would look something like “2015-01-01 00:00:00”. 

From:  Ashish Soni
Reply-To:  <user@cassandra.apache.org>
Date:  Monday, September 28, 2015 at 3:51 PM
To:  <user@cassandra.apache.org>
Subject:  INSERT JSON TimeStamp

If Anyone can help for below as i am getting the error

effectiveStartDate and effectiveEndDate are TimeStamp

INSERT INTO model.RuleSetSchedule JSON ' {
    "ruleSetName": "BOSTONRATES",
    "ruleSetId": "829aa84a-4bba-411f-a4fb-38167a987cda",
    "scheduleId":1,
    "effectiveStartDate": "01/01/2015",
    "effectiveEndDate": "12/31/2015",
    "rules": {
        "1": {
            "condition": "BoardStation",
            "action": "FareAmount=9.25",
            "ruleOrder": "1"
        }
    }

message="Error decoding JSON value for effectivestartdate: Unable to coerce '01/01/2015' to
a formatted date (long)"



-- 
Steve Robenalt 
Software Architect
srobenalt@highwire.org 
(office/cell): 916-505-1785

HighWire Press, Inc.
425 Broadway St, Redwood City, CA 94063
www.highwire.org

Technology for Scholarly Communication



Mime
View raw message