> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# json-stringify-in-loop

> JSON.stringify runs inside a loop instead of serializing once or streaming.

## What it flags

`JSON.stringify()` runs on repeated loop paths, such as a loop body or a `.map` callback. The rule skips recognized per-item output that depends on the current item or index, such as a mapped return value or a value passed to a console method, pushed to an array or written to a stream. Serialization of a loop-invariant value can still be reported.

For global `fetch` bodies and fields in output records, the rule accepts a direct item or a statically named property of that item. A payload that combines the item with growing shared state still reports a finding in those output shapes. The rule also recognizes console diagnostics immediately followed by a throw that leaves the loop.

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "json-stringify-in-loop": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.