--- title: 'You can make PHP throw an exception when decoding JSON if the value isn''t valid JSON' tweet_id: '1454133803056775178' thread_slug: weekly-thread-2021-44 author_username: SteveTheBauman images: - 'https://pbs.twimg.com/media/FCuqk2zWQAsk08o.jpg' created_at: 2021-10-29T17:11:29+00:00 slug: you-can-make-php-throw-an-exception-when-decoding-json-if-the-value-isnt-valid-json --- Had no idea you could have PHP throw a built-in exception when decoding JSON -- I've always done this manually until today 😭