JSON In Python | Part 1

preview_player
Показать описание
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:

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.

Attributions:
Logos used:

Subscribe Video - Free Stock Video Footage by Videezy
Background Music - Road Trip Slynk - Youtube Audio Library
Рекомендации по теме
Комментарии
Автор

Thanks a lot for this video. You have a new subscriber

NNNedlog
Автор

So to search for a key, how do you select how "load/loads" will read the json file? i.e. how do you select it whether it reads it as a python string, dictionary, or list?

Do you have any recommendations on searching for a particular key, say a name in a contact list, and then if found, return the email or phone number for that name?

I'm getting confused, as I see things like :
for elem in
or
for elem in jdata:
if elem['symbol'] == "usd":
pprint (elem)

Or via recursive/generator functions?
def findall(v, k):

if type(v) == type({}):
for k1 in v:
if k1 == k:
print v[k1]
findall(v[k1], k)

findall(json.loads(a), 'P1')

Or via regular expression?
rex1 = \")[a-zA-Z_\- ]+(?=\")')
rex2 = rex1.findall(JSON)

Or xml's parseString?

bennguyen
welcome to shbcf.ru