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
  • НаукаНаука

Комментарии • 16

  • @dave-hollingworth
    @dave-hollingworth  3 месяца назад

    Create a REST API with PHP and MySQL with the Slim framework: ruclips.net/video/PHZtujcTRPk/видео.html

  • @versionoriginal
    @versionoriginal 3 месяца назад +2

    The best teacher at UDEMY!!

    • @ruamtauzla
      @ruamtauzla 3 месяца назад +2

      Couldn't agree more. 😊

  • @efbYouTube
    @efbYouTube 3 месяца назад

    wonderfully & clearly explained as always!! TY!!!

  • @hudinigosh7862
    @hudinigosh7862 3 месяца назад +1

    That is really helpful please upload more advance concept like this. If possible please make videos on std library of php. Thanks for uploading.

  • @ruamtauzla
    @ruamtauzla 3 месяца назад +2

    I like the new fading animation when you're changing sections. ☺️

  • @williamsa51
    @williamsa51 3 месяца назад +1

    Thanks a lot, Dave

  • @fire23hummer
    @fire23hummer Месяц назад +1

    Great content, thank you.

  • @user-wi2db7bq7h
    @user-wi2db7bq7h 3 месяца назад +1

    youre the best !!!

  • @mounir101
    @mounir101 3 месяца назад

    Great, and thanks so much Dave.

  • @abdelhamidnehlil7277
    @abdelhamidnehlil7277 3 месяца назад +1

    Merci beaucoup

  • @MohammedAly-jv6dm
    @MohammedAly-jv6dm 3 месяца назад +1

    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💯

  • @jediampm
    @jediampm 3 месяца назад

    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. ;)

    • @dave-hollingworth
      @dave-hollingworth  3 месяца назад

      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!

  • @veralyons6219
    @veralyons6219 3 месяца назад

    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

  • @bezzybansil8897
    @bezzybansil8897 3 месяца назад

    Can i ask po if you can make a tutorial how to hide and disabled comment in php and not totally delete it?