I want to replace the value in sample json from larger swagger.json file content and it is too large.
Error:
/usr/bin/jq: Argument list too long error bash
The Q does not explicitly say how $swagger
has been set, but it would seem that rather than using --arg swagger $swagger
you would be better off using one of the file-oriented command-line options, perhaps along the lines of:
--argfile swagger swagger.json
There are many alternatives, but to explore these sensibly here, it would be best if you provided at least one complete but very TINY example. (The example does NOT have to illustrate the "Argument list too long" error!)
If you are worried that the --argfile
option is deprecated, then by all means use --slurpfile
instead if your jq
has it, but note that the latter option wraps the file contents into a JSON array, so you would have to take that into account.
These and other options are all presented succinctly in the official documentation at https://stedolan.github.io/jq/manual/