Skip to content

More helpful message when passing a JSON-SEQ file without the --seq flag #3156

@LPardue

Description

@LPardue

Describe the bug
When attempting to parse a JSON-SEQ file, without the --seq flag, jq prints parse error: Invalid numeric literal at line 1, column 4

To Reproduce
The JSON-SEQ format uses an ASCII Record Separator (RS) character at the start of each entry, this is being mistakenly overlooked (by some argument). Example json.

�{"qlog_version":"0.3","qlog_format":"JSON-SEQ","title":"quiche-client qlog","description":"quiche-client qlog id=1928a4431b958983545fe79a00fcf7a670f39d8e","trace":{"vantage_point":{"type":"client"},"title":"quiche-client qlog","description":"quiche-client qlog id=1928a4431b958983545fe79a00fcf7a670f39d8e","configuration":{"time_offset":0.0}}}
�{
  "time": 0.0,
  "name": "transport:parameters_set",
  "data": {
    "owner": "local",
    "tls_cipher": "None",
    "disable_active_migration": true,
    "max_idle_timeout": 30000,
    "max_udp_payload_size": 1350,
    "ack_delay_exponent": 3,
    "max_ack_delay": 25,
    "active_connection_id_limit": 2,
    "initial_max_data": 10000000,
    "initial_max_stream_data_bidi_local": 1000000,
    "initial_max_stream_data_bidi_remote": 1000000,
    "initial_max_stream_data_uni": 1000000,
    "initial_max_streams_bidi": 100,
    "initial_max_streams_uni": 100
  }
}

Expected behavior
It would be nice if jq could relize the record separator character is there, and print a helpful message to retry with --seq
The RFC sort of hints at this use case

since RS may not appear in JSON texts in any other form, RS unambiguously delimits the start of any element in the sequence. RS is sufficient to unambiguously delimit all top-level JSON value types other than numbers.

Environment (please complete the following information):

  • Ubuntu
  • jq-1.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions