Skip to content

Instantly share code, notes, and snippets.

@whereisaaron
Created September 10, 2020 06:20
Show Gist options
  • Save whereisaaron/8aa074c882f388e17503122a19fd987a to your computer and use it in GitHub Desktop.
Save whereisaaron/8aa074c882f388e17503122a19fd987a to your computer and use it in GitHub Desktop.
Convert JSON object to YAML values for a helm chart
#!/bin/bash
json_to_values() {
json=$1
echo "env:"
jq -r 'to_entries | .[] | " - name: \(.key)\n value: '"'"'\(.value)'"'"'"' <<<$json
}
read -r -d '' foo << END
{
"FOO": "bar bar",
"BAZ": "hhh",
"CHEESE": "Hello world"
}
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment