I\'m trying to add or edit a variable in my package.json from a shell script. So if i have a package.json like this:
{ \"name\": \"my-project\", \"descripti
You can also use jq and sponge (moreutils package) like this :
jq '.foo="bar"' package.json | sponge package.json
With an environment variable :
jq --arg h "$HOMEPAGE" '.homepage=$h' package.json | sponge package.json