For example, this code:
var a = {}; aa = a; JSON.stringify(a);
Throws:
TypeError: Converting circular structure to JSON
My question is how to detect a circular structure?
Crockford's JSON implementation does just that. It looks like it just saves the list when moving the graph of objects. The code is pretty simple.
Here is a function using inline JSON detection
function isCircular (d) { try {JSON.stringify(d)} catch (e) {return true} return false }
Source: https://habr.com/ru/post/1342144/More articles:Android: rotate the image around the center - androidAndroid: performance issue canvas.drawBitmap - performancefacebook like button like wrong url - facebookUnable to place the form in the center - vb.nethttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1342143/connecting-laptopsdesktops-to-form-a-matlab-computing-cluster&usg=ALkJrhgjHrFM_GL9KasPloDt17-YNOh-0gProblem StartPosition in C #? - c #Can I use my own message loop in windows? - c ++NSIS installer. UAC - can elevation occur only after the user selects a path? - installerHow can I generate multi-core load on Stata / MP? - stataOdd behavior using custom dict class as attribute of __dict__ of Python classes - pythonAll Articles