🌐
Python
docs.python.org › 3 › library › json.html
json — JSON encoder and decoder
If the data being deserialized is not a valid JSON document, a JSONDecodeError will be raised. Changed in version 3.6: All parameters are now keyword-only. ... Return the Python representation of s (a str instance containing a JSON document).
🌐
W3Schools
w3schools.com › python › python_json.asp
Python JSON
JSON is text, written with JavaScript object notation. ... Python has a built-in package called json, which can be used to work with JSON data.
🌐
Python
docs.python.org › 3.10 › library › json.html
json — JSON encoder and decoder — Python 3.10.22 documentation
The old version of JSON specified by the obsolete RFC 4627 required that the top-level value of a JSON text must be either a JSON object or array (Python dict or list), and could not be a JSON null, boolean, number, or string value.
🌐
Real Python
realpython.com › python-json
Working With JSON Data in Python – Real Python
August 20, 2025 - Learn how to work with JSON data in Python using the json module. Convert, read, write, and validate JSON files and handle JSON data for APIs and storage.
🌐
Coddy.Tech
coddy.tech › learn › courses › python json › the json module
The json Module – Python JSON | Coddy
September 11, 2024 - The json module is a built-in Python library that provides functions for working with JSON data. It allows you to encode Python objects into JSON strings…
🌐
Coddy.Tech
coddy.tech › learn › courses › python json › custom json encoding
Custom JSON Encoding – Python JSON | Coddy
September 11, 2024 - import json from datetime import datetime class Person: def __init__(self, name, birthdate): self.name = name self.birthdate = birthdate class CustomEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, Person): return {"name": obj.name, "birthdate": obj.birthdate.isoformat()} elif isinstance(obj, datetime): return obj.isoformat() return json.JSONEncoder.default(self, obj) person = Person("Alice", datetime(1990, 5, 15)) json_string = json.dumps(person, cls=CustomEncoder, indent=2) print(json_string) This example demonstrates how to encode a custom Person class and handle the datetime object within it. The default() method is called for objects that aren't natively serializable. Always provide a way to fall back to the default encoder for unknown types. Custom encoders are useful for handling complex data structures, custom classes, and non-standard Python types.
🌐
YouTube
youtube.com › corey schafer
Python Tutorial: Working with JSON Data using the json Module - YouTube
In this Python Programming Tutorial, we will be learning how to work with JSON data. We will learn how to load JSON into Python objects from strings and how ...
Published: November 20, 2017
Views: 499K
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 74778499 › how-to-write-in-json-file-in-python
How to write in json file in python? - Stack Overflow
When you're done making your changes, you use json.dump to write it back out to the file. ... To serialize an object (list, dictionary, etc.) in Python to the JSON format use the json library with either the json.dump() or json.dumps() function.
🌐
Reddit
reddit.com › r/pythonlearning › using python to parse a json object
r/PythonLearning on Reddit: Using Python to Parse a JSON Object
March 6, 2026 -

Being retired, I’ve embarked on a project to keep my brain working as well as keeping my dwindling Python skills from completely disappearing. 

I’ve been tinkering around with an API that allows me to grab time sequence weather data from a DOT weather station. As with most APIs the data is returned as a json object which to me (and Python) is a really ugly dictionary embedded with subsequent dictionaries that have keys and associated lists/tuples of values.  For example one such dictionary has the AirTemp as the key with quarter hour values for as many hours I scrape. There are as many of these dictionaries as weather variables I choose to download : wind speed,direction, etc etc. 

My approach to parsing the json object into something readable is to filter out each of the weather variable data into their own dictionary followed by creating a list of all the values in the data dictionary.  

Finally, I zip those lists together and create a dictionary of the date/time variable as the key with the various weather variable values in a list associated to that specific date/time. 

I’m just wondering if there might be different approach would be more efficient (and Pythonic). Sometimes I feel like I'm beating data into submission rather than processing it. This is the first time ever scripting to an API and parsing a json object. 

import requests,json

weather_url = "https://api.weatherdata.com/v2/stations/timeseries?&token=MyToken&units=temp|f,speed|mph&stid=UTHEB&vars=wind_speed,wind_direction,air_temp&obtimezone=local&start=202603031700&end=202603032200"

response = requests.get(weather_url)
responseStatusCode = (response.status_code)

if responseStatusCode == 200:
    print(f"Connected to Weather Data Server; data incoming")
    jsonStr = response.json()

    tempDict = jsonStr['STATION'][0]#dictionary in json object with data
    obsDict = tempDict['OBSERVATIONS']#dictionary in station of data

    #begin list creation:

    dateList = obsDict['date_time']
    localDateList =[i.replace("T"," ").replace(":00-0700","-MT").replace("TimeStamp: ","") for i in dateList]

    airTempList = obsDict['air_temp_set_1']
    windSpeedList = obsDict['wind_speed_set_1']
    windDirectionList = obsDict['wind_direction_set_1']

    displayDict= {date: [speed,direction,temp]
    for date,speed,direction,temp in zip(localDateList,windSpeedList,windDirectionList,airTempList)}
    for key,value in displayDict.items():
        print(f"Date-Time: {key} WindSpeed MPH: {value[0]} WindDirection Degrees: {value[1]}  AirTemp: {value[2]}")
else:
    print(f"Unable to connect to Weather Data Server: try again later")
🌐
Read the Docs
python.readthedocs.io › fr › latest › library › json.html
19.2. json — JSON encoder and decoder — documentation Python 3.7.0a0
The old version of JSON specified by the obsolete RFC 4627 required that the top-level value of a JSON text must be either a JSON object or array (Python dict or list), and could not be a JSON null, boolean, number, or string value.
🌐
Medium
medium.com › @idelossantosruiz › mastering-json-in-python-oop-a-practical-guide-65b39e868c33
Mastering JSON in Python OOP: A Practical Guide | by Ildeberto de los Santos Ruiz | Medium
June 4, 2025 - JSON (JavaScript Object Notation) is a lightweight data format for exchanging structured data. In Python, the json module makes it easy to convert between native data structures (like dicts and lists) and JSON strings or files.
🌐
Scaler
scaler.com › home › topics › read json file in python
Read JSON file in Python - Scaler Topics
June 2, 2022 - JSON (JavaScript Object Notation) is a language-independent data format used to store or represent structured data. A web application and its server can transmit and receive data using the JSON format. Python supports JSON through a built-in package named JSON.
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › how to prettyprint a json file with python?
How to PrettyPrint a JSON File Using Python?
December 13, 2022 - When viewing JSON files in Python, PrettyPrint helps format the text in a visually pleasing format.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-json
Python JSON - GeeksforGeeks
December 23, 2025 - Python JSON (JavaScript Object Notation) is a data format for storing and transferring data, supported via the built-in json module for parsing, serializing and deserializing.
🌐
GitHub
github.com › python › cpython › blob › main › Lib › json › __init__.py
cpython/Lib/json/__init__.py at main · python/cpython
:mod:`json` exposes an API familiar to users of the standard library · :mod:`marshal` and :mod:`pickle` modules. It is derived from a · version of the externally maintained simplejson library. · Encoding basic Python object hierarchies:: · >>> import json ·
🌐
McNeel Forum
discourse.mcneel.com › grasshopper
Automating dumping to json - Python in Grasshopper - Grasshopper - McNeel Forum
April 2, 2024 - I have a workflow in grasshopper that loops through a json, does a bunch of complicated stuff, and then needs to write a unique json for each successive loop, which is initiated by a counter. I’m used to dumping files in Python in other IDEs, however using only json.dump does not seem to ...
🌐
Mimo
mimo.org › glossary › python › json
Python JSON: Syntax, Usage, and Examples
You’ll use JSON all the time when working with APIs, configuration files, and data exchange between apps. In Python, JSON support comes from the built-in json module.
🌐
Bobdc
bobdc.com › blog › pythonjson
Parsing JSON with Python
December 15, 2024 - My sample demo data to parse is pretty close to the test input that I used when I wrote about JSON2RDF: { "mydata": { "color": "red", "amount": 3, "arrayTest": [ "north", "south", "east", "escaped \"test\" string", "west" ], "boolTest": true, "nullTest": null, "addressBookEntry": { "givenName": "Richard", "familyName": "Mutt", "address": { "street": "1 Main St", "city": "Springfield", "zip": "10045" } } } } ... #!/usr/bin/env python3 import json f = open('jsondemo.js') data = json.load(f) print(data["mydata"]["color"]) print(data["mydata"]["amount"]) # Pull something out of the middle of an ar
🌐
freeCodeCamp
freecodecamp.org › news › how-to-use-the-json-module-in-python
How to Use the JSON Module in Python – A Beginner's Guide
June 5, 2023 - You'll often need to read data from a JSON file. For example, you may need to read configuration settings from a JSON file. Python's JSON module provides the json.load() function, which allows you to read and deserialize JSON data from a file.
🌐
YouTube
youtube.com › watch
Reading Multiple JSON files in Python to make an open source dictionary - YouTube
In this video I show you how I saved $3,000 with 30 lines of Python that enabled me to use an open source dictionary rather than pay Oxford or Cambridge for ...
Published: April 2, 2022