Тёмный

Parse JSON With PHP 

Traversy Media
Подписаться 2,3 млн
Просмотров 83 тыс.
50% 1

Quick video on how to read and output JSON data using PHP

Наука

Опубликовано:

 

12 янв 2014

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 67   
@silentknight4611
@silentknight4611 Год назад
lol several years later & this tut was still helpful. Helped me on pulling info from an Xbox Api
@IYIrOWN
@IYIrOWN Год назад
Thanks for the awesome video, still helps 8 years later :D
@technojoe
@technojoe 10 лет назад
json beginner here. very helpful! been stuck for over a day now on parsing an array in json into php. this solved every question i had!
@AC-fi8ge
@AC-fi8ge 10 лет назад
Thank you. Great demonstration of basics!
@AndresPerez-wu7ys
@AndresPerez-wu7ys 7 лет назад
Thanks for this! One question, what if I have two or more Json files that I want to parse on the same page?
@geekynerdyguy9567
@geekynerdyguy9567 5 лет назад
thanks a million best explanation I've come across
@kagisoshibambo5897
@kagisoshibambo5897 7 лет назад
Thank you a lot, I am a newbie in php and this is what i really wanted simple and straight foward, TUMBS-UP
@Veso266
@Veso266 7 лет назад
can you show how to parse m3u file and output it into xls or json or xml?
@emanuelgrama9356
@emanuelgrama9356 6 лет назад
That was awesome, I love you, man!
@Evaldas65
@Evaldas65 3 года назад
Thank you, this was a great intro, helped a lot :)
@TorBarstad
@TorBarstad 10 лет назад
Thanks for this. Very helpful! :)
@georgehughes6615
@georgehughes6615 6 лет назад
What does true as the second argument in json_decode do?
@ZeeshanAsif
@ZeeshanAsif 8 лет назад
What if i would like to add pagination ?
@aaronlieu7973
@aaronlieu7973 5 лет назад
What if I want to paginate it after retrieving data from my JSON?
@dimastaufiqurrahman6691
@dimastaufiqurrahman6691 8 лет назад
Thanks Brad, it so useful :)
@anniediamond21webdesign26
@anniediamond21webdesign26 5 лет назад
Many thanks , great tutorial
@sgt.keroro8974
@sgt.keroro8974 8 лет назад
Hi. Can you make a tutorial on how to convert json data into image? JSON file should not be pre-defined, if possible. :|
@jandronapoli
@jandronapoli 4 года назад
You saved my life thanks
@marketadobra-solanska6302
@marketadobra-solanska6302 8 лет назад
Big help, thanks! :)
@aalaka330
@aalaka330 7 лет назад
what if we donot want to access json object from a file? I mean we can return json object using this statement return response()->json([ ]); How to parse it in php?
@sangamshrestha143
@sangamshrestha143 5 лет назад
What if server send JSON in another format i.e. with different array (not movies)? Then it shows an error. I got this type of problem. Is there any solution for that?
@nikoberenguel6098
@nikoberenguel6098 6 лет назад
hi Traversy media .. what if you want to click a link and assign the id to the link , and every time you click the link it will show the data of the id.. example: { "sample":[ "id": "1", "data":{ " sample": "test123", "example": "test456", }, ] }
@PayamJianTV
@PayamJianTV 6 лет назад
Thaks for your videos, I have my Json data in mysql database, can you instruct me how can I get and write data in Json field. for example my user datasuch as name, lastname and address are in meta field
@not4thestreetz935
@not4thestreetz935 6 лет назад
Hello, thanks a lot for this tutorial. Has helped me a lot. One more thing though, How can i save decoded data into my mysql database? I can display it, thanks to your video, but how can i store that data into my db. Thanks
@CarlosHernandezlifeoflos
@CarlosHernandezlifeoflos 9 лет назад
Brad, If I wanted to put the json information in an html table that already has style, what would that be with this code?
@timeismoney2849
@timeismoney2849 10 лет назад
Awesome thank you.
@tharindumadushan1569
@tharindumadushan1569 3 года назад
woow thank you very much ❤❤❤❤
@umairsubhani4081
@umairsubhani4081 4 года назад
Friend i want to get data from api url against a specific id ... i want to get only that movie hows id is 1 not want to get all movies ??? kindly tell me
@zoranstojanovic2662
@zoranstojanovic2662 7 лет назад
Hello Brad, can you show us how to navigate next and previous through $JSON['movies']? Thanx in advance.
@teeed7927
@teeed7927 9 лет назад
Instead of echoing out your html from your PHP file you can use knockoutjs or angularjs to display your json object on the front end which is better practice and your page will load faster.
@pocketman5510
@pocketman5510 7 лет назад
aaaaaayyynd How do I do this with a json file over the internets?
@unknownuser5462
@unknownuser5462 7 лет назад
$url = 'YourURLHere'; $jsondata = file_get_contents($url); $json = json_decode($jsondata, true);
@alph2600
@alph2600 5 лет назад
No bullshit, I like it :)
@vishalsharma5165
@vishalsharma5165 4 года назад
how to get JSON data from the server. . . Pls.
@emperoroma1
@emperoroma1 8 лет назад
very useful information
@hardeepcoder
@hardeepcoder 10 лет назад
but why we are using Json ? i learning json just for study perpose that's why i wanna to clear my point with know power of json ? how is it useful for me as php programmer ?
@jonathannwosu1813
@jonathannwosu1813 9 лет назад
Hardeep Singh It lets you parse data in an easy and quick way.
@robertwelsh2558
@robertwelsh2558 6 лет назад
You can share data between applications, all they need to know is how to read and write json files. In an e-commerce environment you can use standardised json files to get live information from various hotels etc re bookings and rooms, and use the data to build a comparison site; how powerful your comparison site is will depend on how good you are at processing arrays and the content of those json files. In a specific php application you could use json files to store default start-up configuration data. Try your hand with Composer, getcomposer.org, it uses a composer.json file to configure and update web applications that rely on third-party packages.
@VSLComputers
@VSLComputers 2 года назад
Nice video...
@BobbyRollsToo
@BobbyRollsToo 2 года назад
Muchos gracias!
@miko4041
@miko4041 4 года назад
Thank you!
@adam_selamat
@adam_selamat 5 лет назад
Tnx :)
@oussamataleb
@oussamataleb 10 лет назад
Thaanks that's helped me !
@rw7799
@rw7799 5 лет назад
awsome,,,, 20th video i tried and only one to show how to echo the nested elements... if only found this 3 hours ago
@amitagrawal8791
@amitagrawal8791 5 лет назад
Please also explain how to fetch image and vedio .
@raigonzales
@raigonzales 10 лет назад
How do you get values from nested arrays? I can echo prod_name, but i can't echo file_url within and item_price. { "products" : [{ "prod_name" : "Towel", "media" : [{ "file_url" : "site.com/img.jpg" }], "pricing" : [{ "item_price" : "200" }] }] }
@jorgeabarca5970
@jorgeabarca5970 5 лет назад
Nice video !!! Can you share us the source code please ?
@mrmagnetic927
@mrmagnetic927 10 лет назад
how would you wrap the data in html markup? not inside an echo string here is a paste example bpaste.net/show/CFOrx5Gf4VHM40yuCwRI/
@mrmagnetic927
@mrmagnetic927 10 лет назад
Thanks *****
@muhammadramdhani6235
@muhammadramdhani6235 8 лет назад
+Brad Traversy how to make load data with jquery ajax for peformance fastest load page?
@dineshharikrishnan977
@dineshharikrishnan977 10 лет назад
am not getting the correct output. this is the thing which get display. can someone help me, wat amd doing wrong."; foreach($json['movies'] as $movie){ $output .= " ".$movie['title']." "; $output .=" Year: ".$movie['year']." "; $output .=""; $output .=""; } $output .=""; echo $output; ?> Genre: ".$movie['genre']." Starting: ".$movie['starting']."
@FlyingUnosaur
@FlyingUnosaur 9 лет назад
Dinesh H Try that: foreach ($json['actionHolder'][0]['intervalMileage'] as $main){ $output .= ''; $output .= ''.$main['intervalMileage'].''; $action .= ''.$main['action'].''; $output .= ''; }
@affaefd4093
@affaefd4093 7 лет назад
just watched this on seepd 2
@jithind-feverx2818
@jithind-feverx2818 4 года назад
👍
@globalcode410
@globalcode410 Год назад
not worked error for foreach !~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@mynttismart
@mynttismart Год назад
You now need a . In between the html and php. object.= “”.$movie[]…
@drewdrew1468
@drewdrew1468 5 лет назад
This is only useful for a flat json file. Most json that you will be working with will not be flat, but actually have multiple dimensions, and there will be times when you won't know the depth of the json you're working with.
@Dragon19631
@Dragon19631 8 лет назад
Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/json/index.php on line 7
@DanteMarinho
@DanteMarinho 6 лет назад
The same with me... no solution around de internet yet.
@DanteMarinho
@DanteMarinho 6 лет назад
Finally the solution! We need save the data on a encoding file like UTF-8... and voilá! =)
@HasbullahMarwan22
@HasbullahMarwan22 7 лет назад
just for tips n tricks you can drag your files if you want to open them, for example in your browser (Chrome) or Sublime
@sanusbenefits6327
@sanusbenefits6327 4 года назад
Gracias Senor Healthcare API connection successful/parsed
@keithdarr6750
@keithdarr6750 Год назад
$jsondata = file_get_contents("movies.json"); echo $jsondata; $decoded_json = json_decode($jsondata,true); echo $decoded_json['movies'][0]['title']; // not working What am I doing wrong here? I don't get any output from the second echo.
@HasbullahMarwan22
@HasbullahMarwan22 7 лет назад
What about if my data from mysql ?
Далее
JSON Crash Course
24:49
Просмотров 1 млн
Tom🍓Jerry 😂 #shorts #achayanarmyfamily
00:14
Просмотров 14 млн
No one will play with him( #standoff #meme #grenade
00:12
PHP REST API From Scratch [3] - Update & Delete
16:15
Protocol Buffers Crash Course
36:07
Просмотров 239 тыс.
RESTful API With PHP & MySQL
44:39
Просмотров 320 тыс.
Learn JSON in 10 Minutes
12:00
Просмотров 3,1 млн
REST API concepts and examples
8:53
Просмотров 6 млн
Ajax & JSON & PHP Tutorial For Beginners
23:03
Просмотров 13 тыс.
#engineering #diy #amazing #electronic #fyp
0:59
Просмотров 1,8 млн
Красиво, но телефон жаль
0:32
Просмотров 1,4 млн