Implement safeStringify for circular reference handling#425
Implement safeStringify for circular reference handling#425MK-2001 wants to merge 4 commits intowindkh:masterfrom
Conversation
Added a safeStringify method to handle circular references in JSON.
windkh
left a comment
There was a problem hiding this comment.
Hi, duplicated keys are removed. How is it even possible to have duplicated ones?
The object that is shown in the error does not contain all info. What if the removed key caused the problem?
Wouldnt it be better to return the raw message with a hint that the string is not a valid json?
@MK-2001 what do you think? |
|
It is not a directly a sublimated one, it mir a cut of a circulating structure in an object. If the same object gets identified twice, what is the origin of the current problem, it will crash the application. |
|
If so the root cause of the error should be pointed out clearly in the resulting object. Otherwise somebody will have problems when finding out what was going on. |
|
@MK-2001 Hi Marcus, I just did some investigation about how to handle this correctly Instead of discarding the key somebody in the thread above replaced the reference with a string point out that this is a reference e.g. "circular reference" What do you think about that? |
Situation:
My flow aborted without information when the message was malformed with an editMessageText type.
Added a safeStringify method to handle circular references in JSON.