Serializing an object to JSON stringIn JavaScript, cyclic objects can be handled by providing a function argument (called replacer) to the JSON.stringify method as shown below:
Example 1:
Example 2: The resulting JSON string is {"week":45,"month":7}. |
Got a thought to share or found a
bug in the code?
We'd love to hear from you:
Name: | |
Email: | (Your email is not shared with anybody) |
Comment: |
Facebook comments: