<jupyter_start><jupyter_text>JSON in Python---- JavaScript Object Notation (JSON)- JSON is a syntax for storing and exchanging data.- is text, written with JavaScript object notation.  JSON supports mainly 6 data types:- string- number- boolean- null- object- array JSON in Python---Python has a built-in package called ```json```, which can be used to work with JSON data.``` import json packageimport json```  Convert JSON to Python---```json.loads()``` method allow us to convert JSON String to python object( Python dictionary ).<jupyter_code>import json 
# same JSON:

json_data = '''{
                "name": "Falano",
                "age" : 20,
                "gender": "Male",
                "address": "Manang"
}'''

print("json_data type : ",type(json_data))

# parse json
python_object = json.loads(json_data)
print("python_object type : ",type(python_object))
print(python_object)
print(python_object["name"])<jupyter_output>json_data type :  <class 'str'>
python_object type :  <class 'dict'>
{'name': 'Falano', 'age': 20, 'gender': 'Male', 'address': 'Manang'}
Falano<jupyter_text>Convert from Python Object to JSON```json.dumps()``` can be used to convert Python Object to JSON<jupyter_code>json_dump = json.dumps(python_object)
print(json_dump)
print(type(json_dump))
str = '[{"a":"b"},{"b":[1,2,3,4,4]},{"c":true}]'
pyt = json.loads(str)
type(pyt)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15461703650680028, 'fraction_numerical': 0.0071581961345740875, 'mean_word_length': 4.592, 'pattern_counts': {'":': 6, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '221047', 'license': 'MIT', 'n_tokens_mistral': 458, 'n_tokens_neox': 439, 'n_words': 136, 'path': 'Basics/JSON in Python.ipynb', 'repo_name': 'suraj-shakya/learning_python', 'size': '1397'}