Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document or remove differences between jsesc(data, { json: true }) and JSON.stringify(data) #17

Open
mathiasbynens opened this issue Jul 7, 2014 · 1 comment · May be fixed by #52
Open

Comments

@mathiasbynens
Copy link
Owner

For example, jsesc doesn’t skip undefined properties, and it doesn’t make use of toJSON:

var obj = {
  'toJSON': function() {
    return 'wat';
  }
};

var x = {
  'lol': obj
};

console.log([
  JSON.stringify(x),
  jsesc(x, { 'json': true })
]);
sonneveld added a commit to sonneveld/jsesc that referenced this issue Aug 17, 2014
…{ json: true })` and `JSON.stringify(data)"
sonneveld added a commit to sonneveld/jsesc that referenced this issue Aug 17, 2014
…{ json: true })` and `JSON.stringify(data)"
mathiasbynens pushed a commit that referenced this issue Aug 18, 2014
This brings `jsesc(data, { 'json': true })` closer to `JSON.stringify(data)`.

Fixes #17.
@mathiasbynens
Copy link
Owner Author

jsesc still doesn’t skip undefined properties.

@mathiasbynens mathiasbynens reopened this Aug 18, 2014
@ziir ziir linked a pull request Jul 19, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant