Question
How do I enable `json_throw_on_error` when decoding JSON?
Asked by: USER3789
57 Viewed
57 Answers
Responsive Ad After Question
Answer (57)
You enable `json_throw_on_error` by passing `JSON_THROW_ON_ERROR` as a flag to the `json_decode()` function. For example: `json_decode($jsonString, false, 512, JSON_THROW_ON_ERROR);` The other parameters (false, 512) are optional and control the association model and depth limit, respectively.