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 — JSON encoder and decoder — Python 3.14.3 documentation
3 weeks ago - When a dictionary is converted into JSON, all the keys of the dictionary are coerced to strings. As a result of this, if a dictionary is converted into JSON and then back into a dictionary, the dictionary may not equal the original one.
🌐
W3Schools
w3schools.com › python › python_json.asp
Python JSON
If you have a JSON string, you can parse it by using the json.loads() method.
🌐
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 ...
🌐
GeeksforGeeks
geeksforgeeks.org › json-loads-in-python
json.loads() in Python - GeeksforGeeks
json.loads(s) parses the string and returns a Python dictionary.
Published   May 9, 2025
Top answer
1 of 6
306

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.

🌐
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:
🌐
Bogotobogo
bogotobogo.com › python › python-json-dumps-loads-file-read-write.php
Python Tutorial: json.dump(s) & json.load(s) - 2024
json.load(s) & json.dump(s) There are two ways of reading in (load/loads) the following json file, in.json: {"alpha": 1, "beta": 2} string: import json io = open("in.json","r") string = io.read() # json.loads(str) dictionary = json. loads(string) # or one-liner # dictionary = json.
🌐
GeeksforGeeks
geeksforgeeks.org › python › json-load-in-python
json.load() in Python - GeeksforGeeks
August 11, 2025 - json.load() function in Python is used to read a JSON file and convert it into a corresponding Python object, such as a dictionary or a list.
Find elsewhere
🌐
Note.nkmk.me
note.nkmk.me › home › python
Load, Parse, Serialize JSON Files and Strings in Python | note.nkmk.me
August 6, 2023 - json.loads() — JSON encoder and decoder — Python 3.11.4 documentation
🌐
The Hitchhiker's Guide to Python
docs.python-guide.org › scenarios › json
JSON — The Hitchhiker's Guide to Python
import json parsed_json = json.loads(json_string) and can now be used as a normal dictionary: print(parsed_json['first_name']) "Guido" You can also convert the following to JSON: d = { 'first_name': 'Guido', 'second_name': 'Rossum', 'titles': ['BDFL', 'Developer'], } print(json.dumps(d)) '{"first_name": "Guido", "last_name": "Rossum", "titles": ["BDFL", "Developer"]}' This opinionated guide exists to provide both novice and expert Python developers a best practice handbook to the installation, configuration, and usage of Python on a daily basis.
🌐
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 - Understand use of json.loads() and load() to parse JSON. Read JSON encoded data from a file or string and convert it into Python dict
🌐
Readthedocs
simplejson.readthedocs.io
simplejson — JSON encoder and decoder — simplejson 3.19.1 documentation
See loads() for a description of each argument. The only difference is that this function reads the JSON document from a file-like object fp instead of a str or bytes.
🌐
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.load.html
json.load() — Python Standard Library
json.load(fp, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)[source]¶ · Deserialize fp (a .read()-supporting file-like object containing a JSON document) to a Python object. If the contents of fp is encoded with an ASCII based encoding other than utf-8 (e.g.
🌐
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 - The json.load() function accepts a file object as an argument and returns deserialized JSON data in the form of Python objects such as dictionaries, lists, strings, numbers, booleans, and null values.
🌐
Medium
medium.com › @gadallah.hatem › the-difference-between-json-loads-and-json-load-2dbd30065f26
The difference between json.loads() and json.load() in Python | by Hatem A. Gad | Medium
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.
🌐
Github
he-arc.github.io › livre-python › json › index.html
json — Documentation Bibliothèques Python 1.0.0
Consultez la documentation de JSON Schema pour en savoir plus. ... """Exemple de validation d'un fichier JSON avec JSON Schema.""" import json from jsonschema import validate filename = "test.json" schema = "schema.json" with open(schema, encoding="utf-8") as fp: sch = json.load(fp) with open(filename, encoding="utf-8") as fp: data = json.load(fp) validate(data, sch) print(f"{filename} est valide selon {schema}.")
🌐
OMZ Software
omz-software.com › editorial › docs › library › json.html
18.2. json — JSON encoder and decoder — Editorial Documentation
>>> just_a_json_string = '"spam and eggs"' # Not by itself a valid JSON text >>> json.loads(just_a_json_string) u'spam and eggs'
🌐
Imperial College London
python.pages.doc.ic.ac.uk › java › lessons › java › 10-files › 03-load.html
Python for Java Programmers > Loading JSON files
To load your object directly from a JSON string rather than a file, use json.loads(string) (loads is short for ‘load string’).