Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 531

gcloud publish Pub/Sub JSON message where JSON properties contain space characters

$
0
0

I have a JSON file named countries/list.json I want to publish the content with gcloud CLI.

{"countries": [   {"id": "SE","name": "Sweden"    },    {"id": "UK","name": "United Kingdom"    }  ]}

Accoring to the CLI docs I should be able to use

gcloud pubsub topics publish projects/<PROJECT>/topics/<TOPIC>--message=$(jq -c "." countries/list.json) --attribute "Content-Type=application/json"

This results in

ERROR: (gcloud.pubsub.topics.publish) unrecognized arguments: Kingdom"}]} 

If I change "United Kingdom" to "United-Kingdom" it works, but that is not what I want.


Viewing all articles
Browse latest Browse all 531

Trending Articles