Jq cannot parse users-groups.json

Just having deep dive into the weeds of nix/OS and do some learning.



writes it’s results to a json file

 spec = pkgs.writeText "users-groups.json" (builtins.toJSON {

trying to parse this output with jq fails with

jq: error: syntax error, unexpected IDENT, expecting $end (Unix shell quoting issues?) at , line 1:
jq: 1 compile error

i presume that the json that builtins.toJSON is not exactly what jq likes?

What’s your jq command like? It sounds like you are trying to execute the file name as a jq expression.

Can you try this?

jq < that-file.json
1 Like