mike
mike

Reputation: 101

Facing problems with json decoding

I declared a variable which stores JSON file (output returned from subprocess).

app_data = self.run_subprocess(create_app)

Printed app_data looks like that: (check comments for printed data) I want to grab particular value from this str "appId", so I try to load app_data to json string and grab that value..

json_str = json.loads(app_data)
print(json_str["appId"])

Error

json.decoder.JSONDecodeError: Extra data: line 190 column 1 (char 5767)

Upvotes: 1

Views: 55

Answers (1)

AzyCrw4282
AzyCrw4282

Reputation: 7744

It works fine upon running it and return the value 7f1f91c2-3b28-48ee-96ed-89080980. You can also confirm that it's a valid Json String by checking with a validator here.

The error

json.decoder.JSONDecodeError: Extra data: line 190 column 1 (char 5767)

I believe the error is to do with some malformed character on line 190, right after the line of the closing }. Find that and delete it and it should work fine

Upvotes: 1

Related Questions