Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return more-specific error when input might be application/json-seq
JSON Test Sequences, aka JSON-SEQ, aka application/json-seq are defined in https://datatracker.ietf.org/doc/html/rfc7464. Per the RFC, the format is: any number of JSON texts, each encoded in UTF-8 [RFC3629], each preceded by one ASCII RS character, and each followed by a line feed (LF). jq supports this format but requires the --seq parameter to be used in order to correct parse it. If the option is omitted, then an ambiguous and confusing error message is printed. The RFC is designed to avoid this ambiguity: Since RS is an ASCII control character, it may only appear in JSON strings in escaped form (see [RFC7159]), and 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. This change adds ASCII RS character (0x1e) detection when --seq is omitted, and prints a useful error message recommending to retry with the option. Fixes jqlang#3156.
- Loading branch information