I think you need to wrap the entire json string in quotes. From GEODE-3001
<https://issues.apache.org/jira/browse/GEODE-3001>:

gfsh>put --key-class=io.pivotal.gemfire.testing.MyKey
--key="{'identifier': 'KIWI131117+65', 'name':'name'}" --value=foo2
--region=/foo



On Thu, Aug 17, 2017 at 6:15 AM Dinesh Akhand <dines...@amdocs.com> wrote:

> Hi I tried below,
>
> gfsh>query --query='select e.key from /CUSTOMER_1.entrySet e'
>
> Result     : true
> startCount : 0
> endCount   : 20
> Rows       : 7
>
>                name                | customerID | cycleCode |
> customerGroup | partitionID
> ---------------------------------- | ---------- | --------- |
> ------------- | -----------
> amdocs.imdg.model.keys.CustomerKey | 1592       | 1         | 30006
>  | 300062
>
>
> but when I ran
>
> gfsh>remove --region=/ CUSTOMER_1
> --key={\"customerID\":1592,\"customerGroup\":30006,\"cycleCode\":1,\"partitionID\":300062}
> --key-class=amdocs.imdg.model.keys.CustomerKey
> Result    : false
> Message   : Key is not present in the region
> Key Class : java.lang.String
> Key       :
> {\"customerID\":1592,\"customerGroup\":30006,\"cycleCode\":1,\"partitionID\":300062}
> --key-class=amdocs.imdg.model.keys.CustomerKey
>
> Showing error key not exist.
>
> We have customerID=LONG type
> cycleCode = short
> customerGroup = int
> partitionID =int
>
> Can you please suggest.
>
> Thanks,
> Dinesh Akhand
>
>
> From: Barry Oglesby [mailto:bogle...@pivotal.io]
> Sent: Thursday, August 17, 2017 4:18 AM
> To: dev@geode.apache.org<mailto:dev@geode.apache.org>
> Subject: Re: How to export region keys in json file
>
> There isn't anything built in to export keys as JSON. There was some talk
> about exporting values as JSON at one time, but that hasn't been done.
>
> I attached a function to dump the keys as JSON. It just logs them to the
> terminal, but it can easily be changed to write them to a file.
>
> It dumps output like:
>
> Region data contains the following 34 keys:
>
> {"customerID":"28","customerGroup":"group-28","cycleCode":"cycleCode-28","partitionID":28}
>
> {"customerID":"21","customerGroup":"group-21","cycleCode":"cycleCode-21","partitionID":21}
>
> {"customerID":"68","customerGroup":"group-68","cycleCode":"cycleCode-68","partitionID":68}
>
> {"customerID":"81","customerGroup":"group-81","cycleCode":"cycleCode-81","partitionID":81}
>
> {"customerID":"35","customerGroup":"group-35","cycleCode":"cycleCode-35","partitionID":35}
>
> {"customerID":"90","customerGroup":"group-90","cycleCode":"cycleCode-90","partitionID":90}
>
> {"customerID":"15","customerGroup":"group-15","cycleCode":"cycleCode-15","partitionID":15}
>
> {"customerID":"44","customerGroup":"group-44","cycleCode":"cycleCode-44","partitionID":44}
>
>
> Thanks,
> Barry Oglesby
>
>
> On Wed, Aug 16, 2017 at 4:35 AM, Dinesh Akhand <dines...@amdocs.com
> <mailto:dines...@amdocs.com>> wrote:
> Hi,
>
> How I can export Region keys in json file.
>
> It will help full for us to use get command or remove command for
> particular key when we have the composite keys defined.
>
> get --region=/CUSTOMER_1
> --key=({'customerID':'1593','customerGroup':'30013','cycleCode':'1','partitionID':'300133'})
> --key-class=amdocs.imdg.model.keys.CustomerKey
> Message : Error in converting JSON Couldn't convert JSON to Object of type
> class amdocs.imdg.model.keys.CustomerKey
>
>
> Thanks,
> Dinesh Akhand
> This message and the information contained herein is proprietary and
> confidential and subject to the Amdocs policy statement,
>
> you may review at https://www.amdocs.com/about/email-disclaimer <
> https://www.amdocs.com/about/email-disclaimer>
>
> This message and the information contained herein is proprietary and
> confidential and subject to the Amdocs policy statement,
>
> you may review at https://www.amdocs.com/about/email-disclaimer <
> https://www.amdocs.com/about/email-disclaimer>
>

Reply via email to