Skip to content Skip to sidebar Skip to footer

Stringify Of Js Object Adds Extra Data

I have constructed a JS object using the following snippet after getting some great help here on SO: var noticeMap = $('#preExamNoticesTable tbody tr').map(function() { var $ce

Solution 1:

You're serializing a jQuery object, so all serializable properties in it are being included in the output. Try this instead:

JSON.stringify(noticeMap.get()); // .get will return an array

Solution 2:

http://msdn.microsoft.com/en-us/library/ie/cc836459(v=vs.94).aspx

If value has a toJSON method, the JSON.stringify function uses the return value of that method. If the return value of the toJSON method is undefined, the member is not converted. This enables an object to determine its own JSON representation.

You are stringifying your object, that is why stringify defining json in it's own way

You need to use .get() on your map object to get an array of parameters

noticeMap.get()

Post a Comment for "Stringify Of Js Object Adds Extra Data"