Python json.dumps, Circular Reference Detected.
Category:
Question ID: 109803
0
0

I’m dumping a rather complicated dictionary to json, and something about the format is causing an error, “circular reference detected.”

I can’t post the code but the basic format isĀ 
{a[
a1: a1,
v: [

v1: v1,
v2: v2

]

f: [

f1: f1,

f2: f2

]
]}

filled in from variables through the code and pulling from an API. Any idea what went wrong/where I should start looking?

Marked as spam
Posted by (Questions: 9, Answers: 0)
Asked on August 24, 2020 5:20 pm
9000 views
Answers (1)
0
Private answer

The most common reason for this bug is if you have a dictionary key that is either formatted weird or not a string at all. Make sure you aren't using another dictionary or a list as a dictionary key, all your commas are in place, and possibly check all the API responses you're getting back. It's possible that a response isn't being parsed correctly and you are shoving more data than you thought into the dictionary.

Marked as spam
Posted by (Questions: 0, Answers: 7)
Answered on August 24, 2020 5:22 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top