You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Ashish Soni <as...@gmail.com> on 2015/09/28 21:51:40 UTC

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)"

Re: INSERT JSON TimeStamp

Posted by Russell Bradberry <rb...@gmail.com>.
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:  <us...@cassandra.apache.org>
Date:  Monday, September 28, 2015 at 4:32 PM
To:  <us...@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 <sr...@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 <rb...@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:  <us...@cassandra.apache.org>
Date:  Monday, September 28, 2015 at 3:51 PM
To:  <us...@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



Re: INSERT JSON TimeStamp

Posted by Ashish Soni <as...@gmail.com>.
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 <sr...@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 <rb...@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: <us...@cassandra.apache.org>
>> Date: Monday, September 28, 2015 at 3:51 PM
>> To: <us...@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 <bz...@highwire.org>
> (office/cell): 916-505-1785
>
> HighWire Press, Inc.
> 425 Broadway St, Redwood City, CA 94063
> www.highwire.org
>
> Technology for Scholarly Communication
>

Re: INSERT JSON TimeStamp

Posted by Steve Robenalt <sr...@highwire.org>.
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 <rb...@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: <us...@cassandra.apache.org>
> Date: Monday, September 28, 2015 at 3:51 PM
> To: <us...@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 <bz...@highwire.org>
(office/cell): 916-505-1785

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

Technology for Scholarly Communication

Re: INSERT JSON TimeStamp

Posted by Russell Bradberry <rb...@gmail.com>.
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:  <us...@cassandra.apache.org>
Date:  Monday, September 28, 2015 at 3:51 PM
To:  <us...@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)"