| Page 1 of 1 | [ 5 posts ] |
|
When I try and serialize the shapes on a Graphic object, it throws Converting circular structure to JSON
My code looks like this: Code: var shapes = FC.pitch.get('shapes'); Y.one('#objects').set('text', Y.JSON.stringify(shapes, shapes)); How do you serialise the shapes on my Graphic? |
Alberto SantiniYUI Contributor
|
Hello Stuart.
The following snippet reproduce the case with a simple circular object: http://jsfiddle.net/WkdE6/ The behaviour is correct and it depends on your graphic object. However it seems there is a Douglas's implementation to workaround that: https://github.com/douglascrockford/JSON-js This is a review about cycle.js: http://realgl.blogspot.it/2012/05/cyclic-json.html And a working jsfiddle using that idea: http://jsfiddle.net/snaGx/ Hope that helps, IceBox P.S.: If the serialization is required for debugging purpose, it may feasible to use the debugger tools. |
|
Hi Alberto,
I'm trying to serialize the shapes on my Graphic object so I can save them to a remote server. I take it the techniques you describe aren't built in to YUI be default? |
Alberto SantiniYUI Contributor
|
Hello Stuart.
Converting circular structure to JSON is not an issue related with YUI, but with JSON. Regards, IceBox |
|
I understand that normally it wouldn't be a YUI issue, but with the structure I'm serialising being an internal one to the YUI library, I thought it might be a common enough use case for engineers that it had been tackled already.
|
| Page 1 of 1 | [ 5 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group