Aws-cli: Need "no quotes" string option for JMESPAth output

Created on 6 May 2016  路  6Comments  路  Source: aws/aws-cli

Is there a way to lose the quotes in returned string values?

In order to use output such as the IdentityPoolId from cognito-identity create-identity-pool on the command line the quotes need to me removed.

JMSEPath jp includes an -u/--unquoted option or we can set export JP_UNQUOTED=true

neither work with AWS. Can you please implement?

closing-soon guidance

Most helpful comment

You can do this now with the --output text option. For example, try something like this:

$ aws cognito-identity create-identity-pool --identity-pool-name foo --allow-unauthenticated-identities --query IdentityPoolId --output text
us-east-1:96339a84-0d20-4e67-9b87-fe1f1f854f00

It should output the id that you want without the quotes. Let us know if that helps.

All 6 comments

For now I'm using

IDENTITY_POOL_ID="${IDENTITY_POOL_ID%\"}";IDENTITY_POOL_ID="${IDENTITY_POOL_ID#\"}"

You can do this now with the --output text option. For example, try something like this:

$ aws cognito-identity create-identity-pool --identity-pool-name foo --allow-unauthenticated-identities --query IdentityPoolId --output text
us-east-1:96339a84-0d20-4e67-9b87-fe1f1f854f00

It should output the id that you want without the quotes. Let us know if that helps.

AH, OK thanks will give it a go. I had assume the text output would be ALL the same info as in the json. Ie more than just the ID.

@SteveALee Correct, it shows all the same information.

Gotit --query IdentityPoolId filters even if not JSON output. Effectively -output text reformats the json output.

@JordonPhillips @kyleknap

Yes --output text is perfect. I obviously made invalid assumptions about output formats and relation to the --query option. My bad. It turns out I even forgot to specify the output format at all. I don't see the default specified. I guessed JSON.

Was this page helpful?
0 / 5 - 0 ratings