Better way to query pkgver with curl from package.json

anyone know a better way to query a pkgver from a json file like this with curl:

pkgver=$(curl -o package.json && awk '/version/{gsub(/("|",)/,"",$2);print $2}' package.json)

You could use jq to interpret the JSON file:

pkgver="$(curl | jq -r '.version')"
1 Like

Thank you, but I get this on the build:

build upstream vscode-dev-oss on github with manjaro-chrootbuild

/build/code-git/PKGBUILD: line 15: jq: command not found

[473]( % Total % Received % Xferd Average Speed Time Time Time Current

[474]( Dload Upload Total Spent Left Speed


[477]( 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

[478]( 54 9113 54 4995 0 0 168k 0 --:--:-- --:--:-- --:--:-- 174k

[479]( (23) Failure writing output to destination

[478](> ERROR: pkgver is not allowed to be empty.

[480](> ERROR: Building package [code-git] failed.

Found a bit ugly way to install jq from there, but it work:

@pheiduck What about this? This is a better approach as python is already installed on every system:

pkgver="$(curl -s "" | python3 -c "import sys, json; print(json.load(sys.stdin)['version'])")"
1 Like

will try, hope the latest step will pass now.:

After fixing the CI its working now to build on github:
Thank you @ishaanbhimwal

1 Like

query the electron version as well with curl and awk here

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.