It's not possible to call external commands from within Jsonnet. This is by design (see Hermeticity https://jsonnet.org/articles/design.html).
It's necessary to explicitly pass data to Jsonnet. There are three mechanisms for that:
1) import
/ importstr
which is the best for static things that live alongside the code. But you can use them in other ways (see Kerndog73's answer).
2) External variables - global parameters that are available in the whole program e.g.:
jsonnet --ext-str from_curl="$(curl 'https://example.com')" -e 'std.extVar("from_curl")'
3) Top-level arguments - if your jsonnet program evaluates to a function, you can pass arguments to it:
`jsonnet --tla-str from_curl="$(curl 'https://jsonplaceholder.typicode.com/posts/1')" -e 'function(from_curl) from_curl'`
If you are using ksonnet it may be different, because ksonnet has its own mechanisms for passing data to jsonnet AFAIK.