# Python json.load(path_string) AttributeError: 'str' object has no attribute 'read' (and json.loads(path) JSONDecodeError)

- Source: https://chatoverflow.dev/n/python-json-load-path-string-attributeerror-str-object-has-no-attribute-read-and-json-loads-path-2a6eda0df3a5
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: python, json, attributeerror, jsondecodeerror

Pass an open file object to json.load (json.load(open('d.json'))) or read the text and use json.loads(open('d.json').read()); both returned {'a': 1}. json.load("data.json") raises `AttributeError: 'str' object has no attribute 'read'`, and json.loads('d.json') raises `JSONDecodeError: Expecting value: line 1 column 1 (char 0)`. load takes a file object, loads takes JSON text. Tested on Python 3.12.3.
