Linked Questions
30 questions linked to/from Serializing object that contains cyclic object value
1 vote
0 answers
385 views
Make JSON dump of JS-object window.navigator [duplicate]
For some debugging and statistics need to recursive convert to JSON JavaScript-object "window.navigator" and send it to server. But have problem with it. For example i use JSON-plugin for jquery: ...
907 votes
32 answers
965k views
How can I print a circular structure in a JSON-like format?
I have a big object I want to convert to JSON and send. However it has circular structure, so if I try to use JSON.stringify() I'll get: TypeError: Converting circular structure to JSON or ...
603 votes
8 answers
470k views
How can I pretty-print JSON using node.js?
This seems like a solved problem but I am unable to find a solution for it. Basically, I read a JSON file, change a key, and write back the new JSON to the same file. All works, but I loose the JSON ...
90 votes
11 answers
189k views
Best way to serialize/unserialize objects in JavaScript?
I have many JavaScript objects in my application, something like: function Person(age) { this.age = age; this.isOld = function (){ return this.age > 60; } } // before serialize,...
97 votes
7 answers
127k views
Stringify (convert to JSON) a JavaScript object with circular reference
I've got a JavaScript object definition which contains a circular reference: it has a property that references the parent object. It also has functions that I don't want to be passed through to the ...
9 votes
3 answers
11k views
Passing an object with circular references from server to client-side Javascript while retaining circularity
I'm trying to pass an object with circular references from node.js server to client-side javascript. Server (node.js): var object = { circular: object } //.... app.get('/', function(req, res){ ...
0 votes
2 answers
17k views
How to Encode from Extjs.Class to JSON String?
I want to Encode EXTjs Class to Json, But, I can't.. I use JSON.stringify, but that gives Exception with Type error. How can I do that? Thanks and Here my Code. Ext.define('Text',{ extend : '...
3 votes
2 answers
13k views
JSON.stringify throws error
var Products = [ { id: 0, product: 'Sour Apple', price: 10, count: 1, product_thumb: 'resources/css/apple.png' }, { id: 1, product: '30 dsfdf', price: 20, count: 1, product_thumb: 'resources/...
1 vote
2 answers
6k views
Stringify and parse JSON (serializing an object structure) and deserializing, converting a JSON string into an object structure?
Can anyone guide me how I do this in Javascript? Create an object with two methods. It should stringify and parse JSON, ie it has a method of serializing an object structure, and another method for ...
3 votes
1 answer
7k views
cyclic object value error when converting JSON object to String using JSON.stringify()
I have a JSON object of format: obj { name: "abc" , entriesList : "list of entry obj" , propertiesList : "list of properties obj" }; where entry is also another object entry { ...
0 votes
3 answers
3k views
In PHP how to use $_REQUEST to retrieve an array of inputs to enter into a database
I am using AJAX to send inputs from a webpage to a PHP file to then be entered into a database. Here is my JavaScript file: var pageLoaded = function () { var submitButton = document.getElementById("...
2 votes
2 answers
2k views
How to persist HTTP response in redis
I am creating a long-polling chat application on nodeJS without using Socket.io and scaling it using clusters. I have to find a way to store all the long-polled HTTP requests and response objects in ...
5 votes
2 answers
327 views
Test deep equality *with sharing* of JavaScript objects
Much ink has been spilled on the subject of testing two objects for deep equality in JavaScript. None, however, seem to care about distinguishing the following two objects: var o1 = [{},{}]; var ...
0 votes
0 answers
2k views
JSON.stringify cannot serialize cyclic structures, how to fix?
Here is my code, the error occurs under the function saveData. export default class App extends Component{ constructor(props){ super(props); this.state = { Task: '', }; } ...
3 votes
2 answers
575 views
Stringify timestamp object
How can i JSON.stringify the following data-structure? var Records = { 1357775376232: { pageX: 0, pageY: 0, scrollLeft: 0, scrollTop: 0, target: #document, ...