Get data from the URL and then call json.loads e.g.
Python3 example:
import urllib.request, json
with urllib.request.urlopen("http://maps.googleapis.com/maps/api/geocode/json?address=google") as url:
data = json.loads(url.read().decode())
print(data)
Python2 example:
import urllib, json
url = "http://maps.googleapis.com/maps/api/geocode/json?address=google"
response = urllib.urlopen(url)
data = json.loads(response.read())
print data
The output would result in something like this:
{
"results" : [
{
"address_components" : [
{
"long_name" : "Charleston and Huff",
"short_name" : "Charleston and Huff",
"types" : [ "establishment", "point_of_interest" ]
},
{
"long_name" : "Mountain View",
"short_name" : "Mountain View",
"types" : [ "locality", "political" ]
},
{
...
Answer from Anurag Uniyal on Stack OverflowPython
docs.python.org › 3 › library › json.html
json — JSON encoder and decoder
2 weeks ago - 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.
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.
How to get JSON from webpage into Python script - Stack Overflow
Got the following code in one of my scripts: # # url is defined above. # jsonurl = urlopen(url) # # While trying to debug, I put this in: # print jsonurl # # Was hoping text would contain the ac... More on stackoverflow.com
Moldova broke our data pipeline
If the DMS output isn’t quoting fields that contain commas, that’s technically invalid CSV · A small normalization step before COPY (or ensuring the writer emits RFC-compliant CSV in the first place) would make the pipeline robust without renaming countries or changing delimiters More on news.ycombinator.com
Why Parse JSON With Python When Pandas Exists? : learnpython
Doing it with pure Python is interesting. It's incredibly flexible. It's time consuming. Is it silly? I'm generally up for doing things the... More on old.reddit.com
Storing and querying large json array of data
I think it will be "cleaner" to insert the JSON-data in the database as it is collected, then work on it, and then create the report using database queries. Even "small" database engines like MySQL are efficient at handling large volumes of data. Lots of boilerplate like caching in memory, encoding data, storing it to disk, sorting, querying logic, et cetera, will all be done "for free" inside the database. Maybe the database will be slower than custom searches in a dict-like structure living in RAM, but, if the entire structure will not fit inside the RAM available, anything one does in Python or even Pandas is likely to be a worse. . More on reddit.com
Videos
17:54
Python Standard Library: JSON - YouTube
13:22
JSON Tutorial in Python - YouTube
03:30
How to Work with JSON Data in Python | Parse, Read & Write JSON ...
How To Use JSON In Python
07:42
Working with Files in Python #8 - Working with JSON Files - YouTube
01:19
Master JSON in Python: Convert Python Objects to JSON Easily! - ...
GeeksforGeeks
geeksforgeeks.org › python › reading-and-writing-json-to-a-file-in-python
Reading and Writing JSON to a File in Python - GeeksforGeeks
Reading JSON in Python means retrieving JSON data from a file or string and converting it into Python objects like dictionaries or lists. This process is called deserialization.
Published August 5, 2025
Model Context Protocol
modelcontextprotocol.io › docs › develop › build-server
Build an MCP server - Model Context Protocol
Python · LLMs like Claude · When implementing MCP servers, be careful about how you handle logging:For STDIO-based servers: Never write to stdout. Writing to stdout will corrupt the JSON-RPC messages and break your server. The print() function writes to stdout by default, but can be used safely with file=sys.stderr.For HTTP-based servers: Standard output logging is fine since it doesn’t interfere with HTTP responses.
QuickType
quicktype.io
Convert JSON to Swift, C#, TypeScript, Objective-C, Go, Java, C++ and more
quicktype generates types and helper code for reading JSON in C#, Swift, JavaScript, Flow, Python, TypeScript, Go, Rust, Objective-C, Kotlin, C++ and more. Customize online with advanced options, or download a command-line tool.
Top answer 1 of 10
452
Get data from the URL and then call json.loads e.g.
Python3 example:
import urllib.request, json
with urllib.request.urlopen("http://maps.googleapis.com/maps/api/geocode/json?address=google") as url:
data = json.loads(url.read().decode())
print(data)
Python2 example:
import urllib, json
url = "http://maps.googleapis.com/maps/api/geocode/json?address=google"
response = urllib.urlopen(url)
data = json.loads(response.read())
print data
The output would result in something like this:
{
"results" : [
{
"address_components" : [
{
"long_name" : "Charleston and Huff",
"short_name" : "Charleston and Huff",
"types" : [ "establishment", "point_of_interest" ]
},
{
"long_name" : "Mountain View",
"short_name" : "Mountain View",
"types" : [ "locality", "political" ]
},
{
...
2 of 10
165
I'll take a guess that you actually want to get data from the URL:
jsonurl = urlopen(url)
text = json.loads(jsonurl.read()) # <-- read from it
Or, check out JSON decoder in the requests library.
import requests
r = requests.get('someurl')
print r.json() # if response type was set to JSON, then you'll automatically have a JSON response here...
FastAPI
fastapi.tiangolo.com › tutorial › body
Request Body - FastAPI
...as description and tax are optional (with a default value of None), this JSON "object" would also be valid: ... from fastapi import FastAPI from pydantic import BaseModel class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None app = FastAPI() @app.post("/items/") async def create_item(item: Item): return item · ...and declare its type as the model you created, Item. With just that Python type declaration, FastAPI will:
Hacker News
news.ycombinator.com › item
Moldova broke our data pipeline | Hacker News
1 week ago - If the DMS output isn’t quoting fields that contain commas, that’s technically invalid CSV · A small normalization step before COPY (or ensuring the writer emits RFC-compliant CSV in the first place) would make the pipeline robust without renaming countries or changing delimiters
Groq
console.groq.com › docs › text-chat
Text Generation - GroqDocs
Generating text with Groq's Chat Completions API enables you to have natural, conversational interactions with Groq's large language models. It processes a series of messages and generates human-like responses that can be used for various applications including conversational agents, content generation, task automation, and generating structured data outputs like JSON for your applications.
DigitalOcean
digitalocean.com › community › tutorials › python-pretty-print-json
How to Pretty Print JSON in Python | DigitalOcean
September 16, 2025 - However, while machines can easily process JSON in its most compact form – often minified into a single line – that efficiency can turn into a significant hurdle for human developers. This guide will walk you through the fundamentals, starting with Python’s 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