Handling JSON data with Python

Поділитися
Вставка
  • Опубліковано 15 лис 2018
  • JSON is one of the most popular data interchangeable formats for exchanging browser-server information. This tutorial explains everything about handling json data with Python.

КОМЕНТАРІ • 158

  • @PyLenin
    @PyLenin  3 роки тому +4

    Hello everyone!! For more insightful articles on Python and Data Engineering, join Pylenin's official Telegram channel.
    t.me/pythonwithpylenin

  • @jamieblaze6514
    @jamieblaze6514 3 роки тому +2

    Exact answer to my problem! If anyone is searching for the title of this video, THIS is the video to watch! I've spent days trying to grasp this (apparently) very simple concept. You've made it crystal clear! A thousand 'thanks'.

    • @PyLenin
      @PyLenin  3 роки тому

      My pleasure !!

  • @DustyCustard
    @DustyCustard 4 роки тому +1

    Thanks Lenin. Totally what I was looking for and understood it all first time - you explain it really well. :)

  • @mari-tn7zb
    @mari-tn7zb 3 роки тому +7

    I just want to say thank you so much!! you are a great teacher and i've learned a lot from you thus far!

    • @PyLenin
      @PyLenin  3 роки тому

      Appreciate your compliments dear. Do share this video with your friends and colleagues who might need it. ❤️❤️❤️

  • @xsaver23
    @xsaver23 3 роки тому

    Thank you, everything was explained properly, it helped fix a syntax error was running into

  • @mikelikeafridge
    @mikelikeafridge 4 роки тому +1

    I love your tutorial. Thank you for making it so easy for me to understand! Looking forward to learning more from you!

  • @thybreault
    @thybreault 3 роки тому

    You make it so easy to follow and understand, thank you very much!!

  • @svmitov
    @svmitov 4 роки тому

    Brilliant explanation and structure! Thank you!

  • @EUU100
    @EUU100 3 роки тому

    Wow God bless you brother, so clear and easy to follow i love it. I subscribed instantly even before finishing the video

  • @nononnomonohjghdgdshrsrhsjgd
    @nononnomonohjghdgdshrsrhsjgd 2 роки тому

    I love your tutorials!

  • @chetankakkireni8870
    @chetankakkireni8870 3 роки тому

    We need more videos of this type..Thanks 👌

  • @morasekhi
    @morasekhi 4 роки тому

    Very nicely done, thank you, I really enjoyed watching this video.

  • @sudzbyte2215
    @sudzbyte2215 4 роки тому +1

    Great explanation, thank you!

  • @hfe1833
    @hfe1833 4 роки тому

    Nice presentation and tutorial

  • @sfs25c
    @sfs25c 5 років тому +1

    Very well explained. Clear my doubt to read JSON file.Thanks a lot

    • @PyLenin
      @PyLenin  5 років тому

      Mission accomplished :-) Do watch other videos and share your feedback !!

    • @aniketsingh9390
      @aniketsingh9390 4 роки тому +1

      please tell me how he make the data in multipleline 3:00

  • @chetankakkireni8870
    @chetankakkireni8870 3 роки тому +1

    Can I get the link for “request library “ i.e., the next tutorial that you mentioned at 18:20 in your video?

  • @higiniofuentes2551
    @higiniofuentes2551 11 місяців тому

    Thank you for this very useful video!

  • @muhammadnurhafiznoormohama7605
    @muhammadnurhafiznoormohama7605 4 роки тому +2

    love the tutorial, very underrated

    • @PyLenin
      @PyLenin  4 роки тому

      Thanks man. Now it's upto you to share it

  • @mrrzapata176
    @mrrzapata176 3 роки тому

    Great tutorial, thank you.

  • @sahilkumar158
    @sahilkumar158 5 років тому +1

    json format is copied to single line from quandl, how to go to multiple line. how did u do in vs code?

  • @jmachado9875
    @jmachado9875 5 років тому +1

    Thank you very much, very clear and concise explanation.

    • @PyLenin
      @PyLenin  5 років тому +1

      My pleasure man !! Do check out other videos and share it with your friends !

  • @GaetanoBarreca
    @GaetanoBarreca 5 років тому +1

    Thanks, man! Excellent explanation.

    • @PyLenin
      @PyLenin  5 років тому

      My pleasure man !! Keep watching other videos and share your opinion.

  • @OlaDevine
    @OlaDevine 4 роки тому +1

    Very educative video thanks.

  • @n.s.karthik5628
    @n.s.karthik5628 5 років тому +1

    Nice explanation 👍

  • @azharkazi7299
    @azharkazi7299 4 роки тому

    Hi i have a CSV file which has strings numbers boolean and null values. I have written a code to convert csv file to json. When i get the out file in json format i see that Numbers, boolean are coming in " " (example "TRUE", "10" for null values " " etc) need help on how to handle this

  • @arete_
    @arete_ 4 роки тому

    What if you have two JSON files where one is missing some keys? How can you do this for multiple JSON files with inconsistent data? Now that would be a realistic scenario.

  • @malasubramanian9654
    @malasubramanian9654 Рік тому

    what if I have the data set given to me in a JSON file instead of extracting data from the net. How do I convert the dictionary dataset to strings for further parsing and tokenizing it!!

  • @BuntyMonty
    @BuntyMonty 4 роки тому

    Hi, I'm recieving data with u prefix I don't want it to be like that. can be considered as requirement ,
    any suggestions?

  • @jonison6847
    @jonison6847 4 роки тому

    Thank you Sir, you are a superb teacher.

  • @maheshgadipea856
    @maheshgadipea856 4 роки тому

    Loved it bro .. Thanks

  • @sirishgambhira8549
    @sirishgambhira8549 4 роки тому

    How to parse json dataset of 2GB?I am unable to load using json.load/json.loads.

  • @hhbadarin
    @hhbadarin 3 роки тому +1

    Super helpful, Thank You!

  • @1UniverseGames
    @1UniverseGames 2 роки тому

    How can I loop or iterate 0 to Maximum number object to print it's specific object items. Say I have A array, inside it has 0 to n max number of objects, and inside this another object which I wanna print. So for each 0...n max number object I will have n number of "text" file so I wanna print it from JSOn, how can I do this?

  • @fernandohumbertonascimento4348
    @fernandohumbertonascimento4348 4 роки тому

    Thanks a lot for the knowledge. It was very usefull.

  • @higiniofuentes2551
    @higiniofuentes2551 11 місяців тому

    Then we don't need ETL process, we can work with Data directly (less space and less time to access the data) => more memory?
    There is a memory limitation in a dict variable?
    Thank you!

  • @mdawadud3520
    @mdawadud3520 3 роки тому

    Thank you so much, man. I way you explain that I really like it. It really to the point.

    • @PyLenin
      @PyLenin  3 роки тому

      Glad to hear it!

  • @kantror100
    @kantror100 3 роки тому

    how can i save json data={'temp':'14', 'humi':'12' (and ect)} to csv file? im not reading another file im just getting every few minutes json like this and i want to save it csv file, any idea how?

  • @shaliniverma1049
    @shaliniverma1049 3 роки тому

    which application you are using to do python coding?

  • @subarnarajshrestha
    @subarnarajshrestha 4 роки тому

    great video brother.....thumbs up/......

  • @eborne66
    @eborne66 5 років тому +1

    You are a good teacher. Thanks

    • @PyLenin
      @PyLenin  5 років тому

      Your compliment means a lot. Thank you so much

  • @ramanmahapatra1514
    @ramanmahapatra1514 4 роки тому

    Can you explain how do we walk through the JSON?

  • @sachitdesa7243
    @sachitdesa7243 3 роки тому

    Hi Lenin, This video is very helpful - Thank you! I am dealing with a json file that is 9GB and getting a few errors. Is there anyway I could contact you to discuss some specifics?

  • @alim241081
    @alim241081 4 роки тому

    Hi lenin,do you have rest api detail tutorial in list.plz help

  • @jk3089
    @jk3089 4 роки тому

    Great, thanx for the Sharing.

  • @Cent-bi6xy
    @Cent-bi6xy 3 роки тому +1

    very well explained!

    • @PyLenin
      @PyLenin  3 роки тому

      Glad it was helpful!

  • @higiniofuentes2551
    @higiniofuentes2551 11 місяців тому

    Could you explain the difference between dump and dumps?
    Thank you!

  • @n.s.karthik5628
    @n.s.karthik5628 5 років тому +1

    Great Explanation , thanks Keep going.

    • @PyLenin
      @PyLenin  5 років тому +1

      My pleasure mate !! means a lot.

    • @aniketsingh9390
      @aniketsingh9390 4 роки тому +1

      please tell me how he make the data in multipleline 3:00

  • @saravanakumar8328
    @saravanakumar8328 4 роки тому

    Good. How to read a JSON file and write it into a text file?! With out mentioning the column names explicitly in the python code. How to pick N number of columns and generate a file with N number of columns...

  • @ThePRATIKCHAUDHARI
    @ThePRATIKCHAUDHARI 3 роки тому

    Hello, can you please make a tutorial on how to make a diff of two different json files and store the results in .json format? thanks!

  • @marveltv5341
    @marveltv5341 5 років тому +3

    Please make tutorial on open CV..
    U taught so well.. please continue.
    Making python data Engineer course

  • @nikitabayanache3068
    @nikitabayanache3068 2 роки тому

    Please expalin how to compare two json files and display the difference between them

  • @Gokul12346
    @Gokul12346 5 років тому +2

    Please continue posting videos for aws and python,best explanation in yt !!

    • @PyLenin
      @PyLenin  5 років тому

      Thanks mate!!! Means a lot

    • @aniketsingh9390
      @aniketsingh9390 4 роки тому +1

      please tell me how he make the data in multipleline 3:00

    • @naveens7120
      @naveens7120 4 роки тому

      @@aniketsingh9390 Did u get ?

    • @aniketsingh9390
      @aniketsingh9390 4 роки тому

      @@naveens7120 yes

  • @codemonk5244
    @codemonk5244 5 років тому +1

    The idea of using type is good it makes u have a better understanding of how things are working.
    i also wrote some code
    import json
    data={
    'name':'TCS',
    'shares': 1024,
    'prices': 244000
    }
    print(type(data))
    #
    json_str = json.dumps(data, indent=4)
    print(json_str)
    print(type(json_str))
    #

    • @PyLenin
      @PyLenin  5 років тому

      Good work my friend !! You understand the concept very well !!

  • @furqaniqbal5369
    @furqaniqbal5369 2 роки тому

    Hi I have question about OASIS TOSCA. Could you help me.

  • @carol2.039
    @carol2.039 4 роки тому

    omg!!!!!!!11 SU PER GOOOOOOOOOOD
    LOVED IT TOTALLY
    Ps: you teach better than my professor

  • @quazimehmoodulhasan5211
    @quazimehmoodulhasan5211 2 роки тому

    how we sort json key data alphabetically in python?

  • @chanhoihang
    @chanhoihang 4 роки тому +1

    Hello, Thanks for the video to explaining the json handling for pythion, I have a question about when I got the file including few json content inside, how to separate the the file at end of each json (like at the end of the json of each line have a "}}"), and what I need to do if we only need to process the fist json content ?

  • @nityanandyadawad926
    @nityanandyadawad926 3 роки тому

    Nice...Sensable topics ...Do you have any session on converting nested json to csv using pandas???

  • @elenaperez6327
    @elenaperez6327 4 роки тому

    Great video! Do you have any videos/links on how to import json data into a postgres (pgadmin4) table using python? 😀

  • @shikhapandey5806
    @shikhapandey5806 4 роки тому

    Can you share the flask tutorial link

  • @shikhapandey5806
    @shikhapandey5806 4 роки тому +1

    Can you please share the link of the next video after this

  • @tushargoyaliit
    @tushargoyaliit 5 років тому +2

    Bhai maza aa gya cool video

    • @PyLenin
      @PyLenin  5 років тому

      Thanks my friend !! Share this video with your friends and do watch other videos on the channel !!

  • @chaitanyakrishna5873
    @chaitanyakrishna5873 5 років тому +1

    Excellent

  • @saurabhbarasiya4721
    @saurabhbarasiya4721 5 років тому +1

    Thank q so much for this explanation
    U r best thanks yrr

    • @PyLenin
      @PyLenin  5 років тому

      Thanks man ! Your compliments mean way more than you can ever imagine. Do share the channel with your friends and hello it grow. 😊

  • @sureshpotladurthi5698
    @sureshpotladurthi5698 3 роки тому

    the video is good - to add further how to load this file to server or excel in the readable format

  • @rajivpandey7208
    @rajivpandey7208 4 роки тому

    why subtitles are not coming in this videos

  • @codemonk5244
    @codemonk5244 5 років тому +1

    One more thing can I use urllib.request to handle API calls instead of request?

    • @PyLenin
      @PyLenin  5 років тому

      Of course you can!!

  • @smrutirocks
    @smrutirocks 4 роки тому +1

    When I try to print my json file I get a ‘u’ next to every key and value pair. Why is that happening? Please explain

    • @PyLenin
      @PyLenin  4 роки тому +2

      The u- prefix just means that you have a Unicode string. When you really use the string, it won't appear in your data.

  • @morasekhi
    @morasekhi 4 роки тому +4

    I can't find the video about python "requests" library you promised to post next.

  • @danielnava7265
    @danielnava7265 4 роки тому +1

    Thanks a lot good video good explanation

  • @rohitkurdukar4615
    @rohitkurdukar4615 5 років тому +2

    very well done , it will be helpful if you create full app with including all these JSON,request module with Flask maybe

    • @PyLenin
      @PyLenin  5 років тому

      Nice Idea !! Will work on it !!

  • @armykatilik183
    @armykatilik183 4 роки тому

    when I print my json file I get error :
    File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
    AttributeError: 'str' object has no attribute 'read'
    how to fix it?

  • @athisii_ekhe6167
    @athisii_ekhe6167 5 років тому +1

    Good one. 👍

    • @PyLenin
      @PyLenin  5 років тому

      Thanks man !!

  • @bhaveshkunbi9561
    @bhaveshkunbi9561 3 роки тому +1

    how to store real time data in json file format? ex : stock market data ?

    • @PyLenin
      @PyLenin  3 роки тому

      You should look for something like Firebase realtime Database.

  • @NikhilKumar-sv2kb
    @NikhilKumar-sv2kb 4 роки тому +1

    great work 👌👌

  • @kishorekumarreddymadithati1162
    @kishorekumarreddymadithati1162 3 роки тому +1

    which editor you are using sir for running programs.

  • @skrtalks2421
    @skrtalks2421 5 років тому +1

    nice tutorial..help full

    • @PyLenin
      @PyLenin  5 років тому

      Thanks mate !!

  • @aniketsingh9390
    @aniketsingh9390 4 роки тому

    how you copy to one line please tell me ..........

  • @aniketsingh9390
    @aniketsingh9390 4 роки тому +2

    mishra jii make a video on how to use pycharm effectively

  • @miaomiao2454
    @miaomiao2454 4 роки тому +1

    when I type in the "json.load()" line, it gives me an error saying that "Extra data: line 2 column 1 (char 340)"

    • @aniketsingh9390
      @aniketsingh9390 4 роки тому

      please tell me how he make the data in multipleline 3:00

    • @TomTerrific121
      @TomTerrific121 4 роки тому

      im getting the same thing

    • @raheebashraf3545
      @raheebashraf3545 4 роки тому

      @@TomTerrific121 Its because of the json data. There must be some error in the code

    • @Shankarnegi1
      @Shankarnegi1 4 роки тому

      I
      Json.loads() you are missing s

  • @ncooper1106
    @ncooper1106 2 роки тому

    Anyone know which editor / compiler he’s using?

  • @1Isamiral1
    @1Isamiral1 4 роки тому

    your videos are very informative can you show how to create data pipeline. Thank you

  • @anjumrohra9778
    @anjumrohra9778 3 роки тому

    I am getting an error while reading json file, mentioned below:
    JSONDecodeError: Extra data: line 2 column 1 (char 4144)
    Please explain this

    • @PyLenin
      @PyLenin  3 роки тому

      I would like to see your code for it. Either comment here or DM me on Instagram @pylenin

  • @salahgouzi2458
    @salahgouzi2458 3 роки тому

    Thank you

  • @codemonk5244
    @codemonk5244 5 років тому +1

    Keep going brother

    • @PyLenin
      @PyLenin  5 років тому

      Thank you so much !

  • @badme9121
    @badme9121 5 років тому +1

    Plz explain separators()

  • @mrrzapata176
    @mrrzapata176 3 роки тому +1

    I can't find the video on requests. Could you send me the link please? many thanks in advance

    • @PyLenin
      @PyLenin  3 роки тому

      Hi.
      Sorry but I never found time to make the video on requests. But now that so many people are texting about it, I will be sure to make one soon❤️❤️

  • @lakshmidvs3258
    @lakshmidvs3258 3 роки тому +1

    Too good explanation . could you please do some videos on pyspark

    • @PyLenin
      @PyLenin  3 роки тому

      Ofcourse. Also join me on my Instagram @pylenin. You can send me tutorial requests there as well.

  • @krittwikakar7520
    @krittwikakar7520 4 роки тому +1

    Hi! I am unable to install jsonlib in anaconda platform . Its showing I need to have ms visual c++ 14.0 for the same Can you plz help?

    • @PyLenin
      @PyLenin  4 роки тому

      I don't think you need to install json. Json library should come already installed

    • @krittwikakar7520
      @krittwikakar7520 4 роки тому

      @@PyLenin Thanks for your prompt response Lenin but while I wrote import json it's having no probs but when I am trying to read a json file its saying there in no name called ....this file does not exist...also I need to read 300 json files to read at a go...plz help....completely naive me in ds :)0 so plz

    • @PyLenin
      @PyLenin  4 роки тому

      @@krittwikakar7520 may be your python file and json does are not in the same folder. You need to mention the correct folder location for your json files.

  • @pratikkhairnar743
    @pratikkhairnar743 4 роки тому +1

    good job brother

    • @PyLenin
      @PyLenin  4 роки тому

      Thanks my friend !!

  • @freddief939
    @freddief939 4 роки тому

    `json.dump...` doesn't need to be assigned to `data_serialized`. The `json.dump` function returns a `None`. The last line of your code, you can remove `data_serialized =` and the scripts would work the same.

  • @giancarlozaballero9964
    @giancarlozaballero9964 5 років тому

    Hi, I got this API link jsonplaceholder.typicode.com/todos and when I try to do it it comes up as a list and not as a dictionary.

    • @PyLenin
      @PyLenin  5 років тому

      Because all the data is within a list. See the data. It is covered by square brackets !!

  • @girishn2285
    @girishn2285 4 роки тому

    Hello Lenin,
    This video was really helpful, I am looking for requests video.
    I couldn't find, Can you please assist me here?
    Regards,

  • @lax976
    @lax976 3 роки тому

    Ati jha2

  • @dhirajtayade7258
    @dhirajtayade7258 4 роки тому

    Hi thnaks for the clearly.
    sir how to contact you

  • @NoMoreTricky
    @NoMoreTricky 2 роки тому

    How to read newlines in json ??

    • @PyLenin
      @PyLenin  2 роки тому

      Please give an example to demonstrate.

    • @NoMoreTricky
      @NoMoreTricky 2 роки тому

      @@PyLenin
      character ....
      Text : hey
      how are you ?
      I want to display how are you in next line

  • @allthewayplease
    @allthewayplease 5 років тому +1

    Thank you for the informative tutorial about handling JSON via API. I have a question about understanding "metadata". please follow this link for example I am providing: www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=MSFT&interval=5min&apikey=demo
    In that link, first thing you will see are "metadata" with 6 different variables. In python, If I want to create column that specified 3 types. How is it possible? I am just curious because some JSON file does not have METADATA in it like in the link shown. Thanks!

  • @abhishek_2nd_19_3
    @abhishek_2nd_19_3 4 роки тому

    Please explain how you convert single line into multiple line

    • @PyLenin
      @PyLenin  4 роки тому

      I think I pressed Cmd + alt + L on Mac !!

    • @abhishek_2nd_19_3
      @abhishek_2nd_19_3 4 роки тому

      What about linux

    • @abhishek_2nd_19_3
      @abhishek_2nd_19_3 4 роки тому

      @@PyLenin I want to convert my json file to csv file please make video as soon as possible in this week if possible I desperately needed

  • @narasimhareddyc6348
    @narasimhareddyc6348 5 років тому +1

    please make tutorial on Django....framework tq sir

  • @saurabhbarasiya4721
    @saurabhbarasiya4721 5 років тому +1

    Please make video in request mudule

    • @PyLenin
      @PyLenin  5 років тому

      Next in line bro !!!