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

Serialize arrays with a toJSON method #64

Closed
Krinkle opened this issue May 23, 2014 · 0 comments
Closed

Serialize arrays with a toJSON method #64

Krinkle opened this issue May 23, 2014 · 0 comments

Comments

@Krinkle
Copy link
Owner

Krinkle commented May 23, 2014

From Loginov.Nick on November 29, 2012 06:38:15

What steps will reproduce the problem?

  1. Define your own toJSON method in Array.prototype. For example

Array.prototype.toJSON = function Array$toJSON() {
return this;
}

  1. JSON.stringify([]) in chrome or firefox produce "[]"
  2. Your implementation goes to infinite recursion.

What is the expected output? What do you see instead?

I want to see the same behavior as native JSON.stringify function.

What version of the product are you using? On what operating system?

version: 2.3 (2011-09-17)

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

@Krinkle Krinkle changed the title Your implementations is not the same as native JSON.stringify Your implementation is not the same as native JSON.stringify May 26, 2014
@Krinkle Krinkle changed the title Your implementation is not the same as native JSON.stringify Implementation differs from native JSON.stringify when there is Array.prototype.toJSON Jul 3, 2014
@Krinkle Krinkle changed the title Implementation differs from native JSON.stringify when there is Array.prototype.toJSON Match native JSON.stringify behaviour when there is Array.prototype.toJSON Jul 3, 2014
@Krinkle Krinkle changed the title Match native JSON.stringify behaviour when there is Array.prototype.toJSON Match native behaviour when there is Array.prototype.toJSON Jul 3, 2014
@Krinkle Krinkle changed the title Match native behaviour when there is Array.prototype.toJSON Serialising arrays with a toJSON method Jul 3, 2014
@Krinkle Krinkle changed the title Serialising arrays with a toJSON method Serialise arrays with a toJSON method Jul 3, 2014
@Krinkle Krinkle changed the title Serialise arrays with a toJSON method Serialize arrays with a toJSON method Jul 3, 2014
@Krinkle Krinkle closed this as completed Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant