deal with circular references in JSON conversion