# `JsonRemedy.Utils.MultipleJsonDetector`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/utils/multiple_json_detector.ex#L1)

Utility for detecting and parsing multiple consecutive JSON values.

Handles Pattern 1 from json_repair Python library:
Multiple complete JSON values like `[]{}` → `[[], {}]`

This must run BEFORE the layer pipeline because:
- Layer 1 might remove trailing JSON as "wrapper text"
- Layer 3 adds commas between `]{` which breaks parsing

Based on json_repair Python library (json_parser.py:78-99)

# `parse_multiple`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/utils/multiple_json_detector.ex#L28)

```elixir
@spec parse_multiple(
  String.t(),
  keyword()
) :: {:ok, term(), boolean()} | {:error, String.t()}
```

Parse JSON string that may contain multiple consecutive values.
Returns {:ok, parsed_value, multiple?} or {:error, reason}

If multiple values found, returns them in an array with multiple?=true.
If single value found, returns it unwrapped with multiple?=false.

Special case: Object continuation patterns like `{"a":1},"b":2}` should
return multiple?=false to let ObjectMerger handle them.

# `parse_with_position`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/utils/multiple_json_detector.ex#L282)

```elixir
@spec parse_with_position(
  String.t(),
  keyword()
) :: {:ok, term(), String.t()} | {:error, String.t()}
```

Parse first complete JSON value and return remaining string.
Returns {:ok, parsed, remaining} or {:error, reason}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
