mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 05:14:04 +00:00
12 lines
No EOL
586 B
Markdown
12 lines
No EOL
586 B
Markdown
---
|
|
title: 'You can check if a string contains JSON by decoding it, encoding it again, and comparing the value with the original'
|
|
tweet_id: '1454133800888410119'
|
|
thread_slug: weekly-thread-2021-44
|
|
author_username: freekmurze
|
|
images:
|
|
- 'https://pbs.twimg.com/media/FC4Bs0lXEA4WV-P.jpg'
|
|
created_at: 2021-10-29T17:11:29+00:00
|
|
slug: you-can-check-if-a-string-contains-json-by-decoding-it-encoding-it-again-and-comparing-the-value-with-the-original
|
|
---
|
|
🔥 A way to check if a string contains valid JSON: just decode it, encode it again, and check if it matches the original value
|
|
#php |