-2

I am trying to open a JSON file in python with the following code:

import json
from pprint import pprint
with open('C:\\Users\\Dave\\Desktop\\data.json') as data_file:    
    data = json.load(data_file)
pprint(data)

But I get the follow error.

ValueError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

I am using the test json {'a':1}

1 Answers1

0

The call to JSON is fine. You can read more about opening JSONs with python.

If you replace your JSON with one of the good JSONs from that post, you will find the it runs just fine.

All you need to do is correctly format your data.

Community
  • 1
  • 1
David Greydanus
  • 2,551
  • 1
  • 23
  • 42