Skip to content

Assertion failure when using --jsonargs with invalid JSON and printing $ARGS #2572

@wader

Description

@wader

Reproduction:

$ ./jq --version
jq-1.6-159-gcff5336

$ ./jq -n --jsonargs '$ARGS' 123 'invalid json'
{
  "positional": [
    123,
Assertion failed: (0 && "Invalid value"), function jv_dump_term, file jv_print.c, line 221.
    [1]    9056 abort      ./jq -n --jsonargs '$ARGS' 123 'invalid json'

# for some reason this don't assert but the invalid JSON is null
$ ./jq -n --jsonargs '$ARGS.positional[0,1]' 123 'invalid json'
123
null

Expected behaviour i think would be to error earlier on invalid JSON

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions