Created
March 6, 2018 23:45
-
-
Save bulkan/d714212aa3c6dc21e717f51c07482f83 to your computer and use it in GitHub Desktop.
example of munging JSON using jq and still getting valid JSON
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat item.json | jq 'map( { | |
amount: .amount, | |
yieldFactor: .yieldFactor, | |
servingSize: .servingSize | { gramsEntered: .gramsEntered }, | |
measures: .measures | map( { | |
amount: .amount, | |
gramsPerUnit: .gramsPerUnit | |
}), | |
foodComponents: .foodComponents | |
})' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment