JSON In Python | Part 1

Published: 21 August 2020
on channel: Swaroop P
2,147
58

JSON, Javascript Object Notation is a widely used file format for data exchange all across the web thanks to the prevalence of Javascript frameworks.

In this video, we will go through the basics of how we can work with json data in Python using the json module.

Timecodes:
00:00 Introduction
00:30 What is JSON?
01:17 Converting JSON string to a dictionary
02: 32 Converting JSON string to a list
02:56 Converting dictionary to JSON string
04:05 Converting list to JSON string
04:22 Reading JSON data from a file
05: 13 Writing JSON data to a file
06:21 Conclusion

Links:
JSON Parsing with Python -   / json-parsing-with-python  
JSON documentation - https://docs.python.org/3/library/jso...

Video Summary:
JSON strings look a lot like Python dictionaries. Python has a built in module "json" for working with JSON data.
Using the module we can perform a lot of operation on the JSON data.

To convert a JSON string to a python dictionary or a list, we use the "json.loads" function.

To convert a python dictionary or a list to a JSON string, we use the "json.dumps" function. To format the output string, we can use the indent keyword and that will make the JSON look nice.

To read JSON from a file, we use the json.load using the file handler of that file.

To write JSON to a file, we use the json.dump, again using the file handler of that file. Even for dump, we can pass in the indent keyword argument to make the output formatted.

Attributions:
Logos used:
Angular Logo - Google / CC BY 4.0 - https://commons.wikimedia.org/wiki/Fi...
Jquery Logo - Jquery / Public Domain - https://en.wikipedia.org/wiki/File:JQ...
Bootstrap Logo - Bootstrap / Public domain - https://commons.wikimedia.org/wiki/Fi...
Vue Logo - Evan You, https://github.com/yyx990803 / CC BY 4.0 - https://commons.wikimedia.org/wiki/Fi...
React Logo - Facebook / Public domain - https://commons.wikimedia.org/wiki/Fi...

Sea/Beach Video - Video by Cinema Professionals from Pexel - https://www.pexels.com/video/rock-for...
Subscribe Video - Free Stock Video Footage by Videezy
Background Music - Road Trip Slynk - Youtube Audio Library


On this page of the site you can watch the video online JSON In Python | Part 1 with a duration of hours minute second in good quality, which was uploaded by the user Swaroop P 21 August 2020, share the link with friends and acquaintances, this video has already been watched 2,147 times on youtube and it was liked by 58 viewers. Enjoy your viewing!