coder here
coder here

Reputation: 189

jq command in windows not working as expected

I am trying to execute a simple jq command in windows but it is not working as expected

C:\Users\Administrator> aws ec2 describe-instances --instance-ids $instanceId --query "Reservations[0].Instances[0].Tags" | jq '.[] | select (.Key=="Name")'

Error:

jq: error: Name/0 is not defined at <top-level>, line 1:
.[] | select (.Key==Name)
jq: 1 compile error

Could someone help me with this?

Upvotes: 1

Views: 489

Answers (1)

js2010
js2010

Reputation: 27516

In Powershell, you have to backslash the double quotes for jq:

PS C:\Users\Administrator> '[{"name":"joe"}]' | jq '.[] | select (.name==\"joe\")'

{
  "name": "joe"
}

Upvotes: 4

Related Questions