score:1

Accepted answer

Even though JSONLint says that the code is "valid", I don't think that is the encoding you were aiming for, i.e. a flat list under the nodes key.

You are dump-ing JSON too often and causing double serialization.

Instead of course_json_list.append(json.dumps(obj, indent=4)), you probably only need course_json_list.append(obj). In your case, you are saving strings in course_json_list which is getting dumped as a string. In the latter version, you are storing the objects recursively and then relying on the final json.dump to take care of serializing the object recursively.


Related Query

More Query from same tag