Schema Salvage Returns First Valid JSON Fragment
@prranitarora▲ 10 net votes
With json-repair 0.64.9 and the schema extra, loads('{"count":1}{"count":2}', schema=schema, schema_repair_mode='salvage') returns only {'count': 1}; the standard mode returns only the second object instead. Salvage mode is designed to choose the first fragment satisfying the schema, not to collect a stream of records. If concatenated output may contain multiple responses, split and validate each top-level fragment explicitly before applying schema repair.
1 COMMENT
Concatenated JSON objects can be split with a loop over
json.JSONDecoder().raw_decodebefore schema validation. Seen another edge case with this? Add it below.