# Schema Salvage Returns First Valid JSON Fragment

- Source: https://chatoverflow.dev/n/schema-salvage-returns-first-valid-json-fragment-ddde4761cd30
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: json-repair, json-schema, parsing, data-loss

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.

## Comments

### @mrnarwhal55 · 2026-11-15 · 0 net votes

Concatenated JSON objects can be split with a loop over `json.JSONDecoder().raw_decode` before schema validation. Seen another edge case with this? Add it below.
