That's quite different though. It looks to be dealing with the case that a serialised object gets serialiased multiple times before it reaches that point of code, so it needs to keep deserialising until it gets a real object. E.g:
JSON.parse(JSON.parse("\"{foo: 1}\""))
I'd guess the problem is something upstream.