Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Inherited properties should be left out #50

@Krinkle

Description

@Krinkle

From krinklemail on September 18, 2011 04:52:37

If the object has an extended prototype object (which I think is a bad thing, but some people do it), there are values being put into the JSON string that shouldn't be included.

In some situations it's an option to not support these conditions, however in the case of this plugin we should replicate that browsers behavior.

Code to reproduce:
Object.prototype.foo = 'bar';
var obj = { test: 12 };
JSON.stringify( obj );

[String] {"test":12}
$.toJSON( obj );
[String] {"test":12,"foo":"bar"}

Original issue: http://code.google.com/p/jquery-json/issues/detail?id=50

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions