Parse JSON in PHP | How to validate and process nested JSON data
HTML-код
- Опубликовано: 13 июн 2024
- Learn what JSON is, and how to process it in PHP.
Please consider supporting my channel: ☕ ko-fi.com/davehollingworth
Topics covered:
• JSON
• Parsing and validating JSON data in PHP
• Nested JSON data
All source code shown is free to download:
‣ gist.github.com/daveh/4aef691...
Links shown in the video:
‣ www.php.net/manual/en/functio...
‣ www.php.net/manual/en/functio...
Videos:
‣ How to call APIs from PHP:
• How to call APIs from ...
‣ How to use a REST API from PHP using cURL:
• How to use a REST API ...
00:00 Introduction
00:14 JSON overview
01:37 Validating JSON
01:49 Sample JSON data
02:44 Decoding JSON in PHP
03:41 Handling invalid JSON
04:25 JSON parsing errors
05:54 JSON exceptions
07:19 Handling nested data
09:00 JSON objects as PHP arrays
10:36 Format JSON with HTML example
12:04 Summary
#PHP #json #project Наука
Create a REST API with PHP and MySQL with the Slim framework: ruclips.net/video/PHZtujcTRPk/видео.html
The best teacher at UDEMY!!
Couldn't agree more. 😊
wonderfully & clearly explained as always!! TY!!!
That is really helpful please upload more advance concept like this. If possible please make videos on std library of php. Thanks for uploading.
I like the new fading animation when you're changing sections. ☺️
Thanks a lot, Dave
Great content, thank you.
youre the best !!!
Great, and thanks so much Dave.
Merci beaucoup
Thanks for all your amazing tutorial, I wonder if you are going to make a tutorial about laravel or symphony; as they are the most wanted php frameworks! please let me know to join in if you do! Thanks again💯
Hi, it was a great explanation however you miss the fact, if you watch your own video on right side of php docs, you will see another php function which was released in php 8.3 ( last year in november) called json_validate. So i recommend you edit and update the video with this recent function.
Thanks. ;)
Hi - you're right, the json_validate function is also available and will validate a JSON string. The documentation is here if anyone wants it: www.php.net/manual/en/function.json-validate.php
I did consider including it in the video, however, as it states in the aforementioned documentation, "Caution: Calling json_validate() immediately before json_decode() will unnecessarily parse the string twice, as json_decode() implicitly performs validation during decoding.
json_validate() should therefore only be used if the decode JSON payload is not immediately used and knowing whether the string contains valid JSON is needed."
So I decided not to include it as we're going to call json_decode anyway to get a parsed version of the string.
If I ever update the video I will mention this though, you're right that developers should at least be aware of it. Thank you for contributing!
Please can you make a video about how pages can be dynamically updated based on an HTML form being written similar to pages that show weak and strong passwords based on the user's input.
Thanks, Dave
Can i ask po if you can make a tutorial how to hide and disabled comment in php and not totally delete it?