Yes, s stands for string. The json.loads function does not take the file path, but the file contents as a string. Look at the documentation.

Simple example:

with open("file.json") as f:
  data = json.load(f)  # ok

  data = json.loads(f)  # not ok, f is not a string but a file
text = '{"a": 1, "b": 2}'  # a string with json encoded data
data = json.loads(text) 
Answer from Gijs on Stack Overflow
🌐
Python
docs.python.org › 3 › library › json.html
JSON encoder and decoder — Python 3.14.6 documentation
>>> import json >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('"\\"foo\\bar"') '"foo\x08ar' >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io) ['streaming API']
🌐
GeeksforGeeks
geeksforgeeks.org › python › json-loads-in-python
json.loads() in Python - GeeksforGeeks
json.loads() is a function from Python’s built-in json module that converts a JSON-formatted string into a corresponding Python object.
Published   January 13, 2026
Discussions

python - What is the difference between json.load() and json.loads() functions - Stack Overflow
Yes, s stands for string. The json.loads function does not take the file path, but the file contents as a string. More on stackoverflow.com
🌐 stackoverflow.com
JSON load() vs loads()

load() loads JSON from a file or file-like object

loads() loads JSON from a given string or unicode object

It's in the documentation

More on reddit.com
🌐 r/learnpython
7
6
October 8, 2015
Why json.dump() and .load() are really needed?
JSON data in python is essentially a dictionary (at least they are interchangeable, there are some minor differences with the formatting). Have you tried saving a dictionary to a simple text file? my_data = { 'a': [1, 2, 3], 'b': {'foo': 'bar', 'baz': [4, 5, 6]} } with open('test_file.txt', 'w') as file: file.write(my_data) This is not possible because Python expects a string that it can write to a file. It doesn't know how to turn a dictionary into something it can write to a file. But, maybe you then do this instead: my_data = { "a": [1, 2, 3], "b": {"foo": "bar", "baz": [4, 5, 6]} } with open('test_file.txt', 'w') as file: # cast my_data to a string first file.write(str(my_data)) And it works. But what if you want to read that file? with open('test_file.txt', 'r') as file: read_data = file.read() Now you have a problem, because your output is this string: "{'a': [1, 2, 3], 'b': {'foo': 'bar', 'baz': [4, 5, 6]}}" How do you convert a string into a dictionary? This here doesn't work: with open('test_file.txt', 'r') as file: read_data = dict(file.read()) Python by itself does not know how to convert a string into a dictionary. For that you need JSON. Also it makes sure that you meet all the conventions of the JSON format so that you can exchange data between different languages (e.g. from Python to JavaScript). The other thing is, if you have a .txt file, how would anybody know that this file contains a data structure without opening the file? If the file extension says "JSON" everybody knows how to interpret the data. Same with .XML, .HTML etc. More on reddit.com
🌐 r/learnpython
18
9
October 15, 2020
Unexpected behaviour of JSON loads
'abc' is a python string, it's not a valid json string. you want: json.loads('"abc"') More on reddit.com
🌐 r/learnpython
3
3
April 9, 2024
🌐
W3Schools
w3schools.com › python › python_json.asp
Python JSON
import json # some JSON: x = '{ "name":"John", "age":30, "city":"New York"}' # parse x: y = json.loads(x) # the result is a Python dictionary: print(y["age"]) Try it Yourself »
🌐
Real Python
realpython.com › python-json
Working With JSON Data in Python – Real Python
August 20, 2025 - As the name suggests, you can use json.load() to load a JSON file into your Python program. Jump back into the Python REPL and load the hello_frieda.json JSON file from before:
🌐
Medium
medium.com › @gadallah.hatem › the-difference-between-json-loads-and-json-load-2dbd30065f26
The difference between json.loads() and ...
December 15, 2024 - Feature json.loads() json.load() Input JSON string (in memory). File object or stream (on disk or in memory). Output Python object (dict, list, etc.). Python object (dict, list, etc.). Use Case Parsing JSON strings (e.g., API responses). Parsing JSON files or streams.
Top answer
1 of 6
310

Yes, s stands for string. The json.loads function does not take the file path, but the file contents as a string. Look at the documentation.

Simple example:

with open("file.json") as f:
  data = json.load(f)  # ok

  data = json.loads(f)  # not ok, f is not a string but a file
text = '{"a": 1, "b": 2}'  # a string with json encoded data
data = json.loads(text) 
2 of 6
138

Just going to add a simple example to what everyone has explained,

json.load()

json.load can deserialize a file itself i.e. it accepts a file object, for example,

# open a json file for reading and print content using json.load
with open("/xyz/json_data.json", "r") as content:
  print(json.load(content))

will output,

{u'event': {u'id': u'5206c7e2-da67-42da-9341-6ea403c632c7', u'name': u'Sufiyan Ghori'}}

If I use json.loads to open a file instead,

# you cannot use json.loads on file object
with open("json_data.json", "r") as content:
  print(json.loads(content))

I would get this error:

TypeError: expected string or buffer

json.loads()

json.loads() deserialize string.

So in order to use json.loads I will have to pass the content of the file using read() function, for example,

using content.read() with json.loads() return content of the file,

with open("json_data.json", "r") as content:
  print(json.loads(content.read()))

Output,

{u'event': {u'id': u'5206c7e2-da67-42da-9341-6ea403c632c7', u'name': u'Sufiyan Ghori'}}

That's because type of content.read() is string, i.e. <type 'str'>

If I use json.load() with content.read(), I will get error,

with open("json_data.json", "r") as content:
  print(json.load(content.read()))

Gives,

AttributeError: 'str' object has no attribute 'read'

So, now you know json.load deserialze file and json.loads deserialize a string.

Another example,

sys.stdin return file object, so if i do print(json.load(sys.stdin)), I will get actual json data,

cat json_data.json | ./test.py

{u'event': {u'id': u'5206c7e2-da67-42da-9341-6ea403c632c7', u'name': u'Sufiyan Ghori'}}

If I want to use json.loads(), I would do print(json.loads(sys.stdin.read())) instead.

Find elsewhere
🌐
PYnative
pynative.com › home › python › json › python json parsing using json.load() and loads()
Python JSON Parsing using json.load() and loads()
May 14, 2021 - When you execute a json.load or json.loads() method, it returns a Python dictionary. If you want to convert JSON into a custom Python object then we can write a custom JSON decoder and pass it to the json.loads() method so we can get a custom Class object instead of a dictionary. Let’s see how to use the JSON decoder in the load method.
🌐
Readthedocs
jansson.readthedocs.io › en › 2.1 › apiref.html
API Reference — Jansson 2.1 documentation
Decodes the JSON string buffer, whose length is buflen, and returns the array or object it contains, or NULL on error, in which case error is filled with information about the error. This is similar to json_loads() except that the string doesn’t need to be null-terminated.
🌐
Programiz
programiz.com › python-programming › json
Python JSON: Read, Write, Parse JSON (With Examples)
import json person = '{"name": "Bob", "languages": ["English", "French"]}' person_dict = json.loads(person) # Output: {'name': 'Bob', 'languages': ['English', 'French']} print( person_dict) # Output: ['English', 'French'] print(person_dict['languages'])
🌐
Beautiful Soup
tedboy.github.io › python_stdlib › generated › generated › json.loads.html
json.loads() — Python Standard Library
json.loads() View page source · json.loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)[source]¶ · Deserialize s (a str or unicode instance containing a JSON document) to a Python object.
🌐
Analytics Vidhya
analyticsvidhya.com › home › python json.loads() and json.dump() methods
Python json.loads() and json.dump() methods - Analytics Vidhya
May 1, 2025 - The json.loads() function in Python is used to parse a JSON string and convert it into a Python object. It takes a JSON string as input and returns a corresponding Python object.
🌐
Note.nkmk.me
note.nkmk.me › home › python
Load, Parse, Serialize JSON Files and Strings in Python | note.nkmk.me
August 6, 2023 - You can use json.loads() to convert JSON-formatted strings into Python objects, such as dictionaries.
🌐
GeeksforGeeks
geeksforgeeks.org › python › json-load-in-python
json.load() in Python - GeeksforGeeks
April 3, 2026 - It reads JSON data from a file and converts it into the corresponding Python object.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-difference-between-json-load-and-json-loads
Difference Between json.load() and json.loads() - Python - GeeksforGeeks
July 3, 2025 - json.load() takes a file object and returns the json object. It is used to read JSON encoded data from a file and convert it into a Python dictionary and deserialize a file itself i.e.
🌐
Codecademy
codecademy.com › docs › python › json module › .load()
Python | JSON Module | .load() | Codecademy
May 29, 2025 - The .load() method in Python’s JSON module is used to parse JSON data from a file-like object and convert it into a Python object. This method reads JSON content directly from files, such as .json files, and transforms the structured data ...
🌐
Reddit
reddit.com › r/learnpython › json load() vs loads()
r/learnpython on Reddit: JSON load() vs loads()
October 8, 2015 -

Can someone explain what the difference is between using either load() or loads() is with the JSON library? And which, if either, is the preferred method.

I'm writing a simple script where I want the JSON data from a URL parsed out into a list. Both of these options seem to work:

import json
import urllib2

url = "string to url"

response = urllib2.urlopen(url)
data = json.load(response)

or

import json
import urllib2

url = "string to url"

response = urllib2.urlopen(url)
data = json.loads(response.read())

I know that there are other libraries available for parsing out JSON data, but for the time being I'm working only with the json and urllib2 libraries.

Any insight into which one should be used?

Thanks

🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python json.loads() method with examples
Python json.loads() Method with Examples - Spark By {Examples}
May 31, 2024 - The json loads() is a method from the json Python module that is used to parse a JSON (JavaScript Object Notation) string and convert it into a Python
🌐
Tutorialspoint
tutorialspoint.com › python › json_loads_function.htm
Python json.loads() Function
The Python json.loads() function is used to parse a JSON-formatted string and convert it into a corresponding Python object. This function is useful when working with JSON data received from APIs, reading configuration settings, or processing