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.
๐ŸŒ
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
๐ŸŒ
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 ...
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.
๐ŸŒ
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.
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 - 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
๐ŸŒ
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.
๐ŸŒ
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.
๐ŸŒ
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
๐ŸŒ
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.
๐ŸŒ
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.
๐ŸŒ
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'
๐ŸŒ
Readthedocs
jsons.readthedocs.io
Features โ€” jsons documentation
instance = jsons.load(dumped, Car) Type hints for the win! Frequently Asked Questions ยท Do I need to use dataclasses? Do I need to use type hints? How can I improve the performance of jsons? Is it possible to discard private attributes? How can I write a custom serializer?
๐ŸŒ
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}.")
๐ŸŒ
Readthedocs
python-rapidjson.readthedocs.io โ€บ en โ€บ latest โ€บ loads.html
loads() function โ€” python-rapidjson 1.17 documentation
rapidjson.loads(string, *, object_hook=None, number_mode=None, datetime_mode=None, uuid_mode=None, parse_mode=None, allow_nan=True)ยถ ยท Decode the given JSON formatted value into Python object.