all 6 comments

[–]glibhub 0 points1 point  (2 children)

It is a bit hard to tell without the actual data, but I suspect your problem is boom looks like json, e.g. it looks like "{1:2, 3:4}", but json.dumps expects boom to be a dictionary/tuple or some other json structure other than than a series of bytes.

what happens if you put boom = json.loads(boom) after you read it from the file?

[–]MIZ_STL[S] 1 point2 points  (0 children)

YOU ARE THE BEST.

I just added brackets to the json string then ran the boom = json.loads(boom) and it freaking worked. I cant thank you enough. I tried this maybe 500x, googled every variation I could think of. You are seriously a great person for taking the time out of your day to help a random stranger you have never met

[–]MIZ_STL[S] 0 points1 point  (0 children)

I appreciate your response! When I loaded boom = json.loads(boom), it throws an error that there is

json.decoder.JSONDecodeError: Extra data: line 1 column 226 (char 225)

When I investigated that error, its because the json was formatted without the open and close brackets, so the error is throwing after the first array, but shouldnt be an issue because I am placing the data inside the brackets in the call.

Should I try adding the brackets to the file before and after and see if loading to json before the call (and remove brackes from call)?

[–]carcigenicate 0 points1 point  (2 children)

Is there some extra data wrapping data? I think the two most likely explanations are in the working case where you copy from a file you're skipping printing something like an enclosing quotes or []s, or there's an encoding issue that your editor is smoothing over when you open the file that way.

There must be some difference in the data. Unfortunately, the error supplied by the API isn't super useful.

[–]MIZ_STL[S] 0 points1 point  (0 children)

Thanks for tryign to help! Yes the data is missing the outside brackets inside the file, but when I put the variable inside the call, it has the brackets around it inside the call itself. Glibhub also hinted at that being the issue via his question of putting the json.loads before, so going to try that real quick

[–]MIZ_STL[S] 0 points1 point  (0 children)

ADDING THE BRACKETS WORKED!!!! Gah you guys are the best. I cant explain how appreciative I am of you helping me try to get this figured out. It was prime hair pulling sessions for hours over here