Sanitize circular dependencies with a string representation.

Circular dependencies and JSON serialization don't play well together.
Depending on the library it might throw a SystemStackTooDeep or even segfault
the interpreter.

Here we replace the circular depency with a "[...]" or "{...}" string
representation that should make it clear later on what happened.