Skip to content

When the browser does not support JSON.rawJSON/JSON.isRawJSON, the rewritten JSON.stringify(value, replacer) does not match the native behavior #1539

Closed

Description

@WeaponZhao

Test environment: Google for testing v113.0.5672.0

The following are the inputs and outputs of native methods in the Console

JSON.stringify
// ƒ stringify() { [native code] }
JSON.rawJSON
// undefined
JSON.rawJSON
// undefined
const params = {"cfgType": "bpmn_sort", "cfgCode": "xms-todo", "1": "1", "0": "0"}
// undefined
JSON.stringify(params, ["cfgCode", "cfgType"])
// '{"cfgCode":"xms-todo","cfgType":"bpmn_sort"}'
JSON.stringify(params, ["cfgCode", "cfgType", "1", "0"])
// '{"cfgCode":"xms-todo","cfgType":"bpmn_sort","1":"1","0":"0"}'
JSON.stringify(params)
// '{"0":"0","1":"1","cfgType":"bpmn_sort","cfgCode":"xms-todo"}'

The following are the inputs and outputs of the override method in the Console

JSON.stringify
// ƒ (e,t,n){var i=B(t),r=[],o=M(e,(function(e,t){var n=u(i)?a(i,this,A(e),t):t;return!b&&d(n)?I+(O(r,n.rawJSON)-1):n}),n);if("string"!=typeof o)return o;if(P&&(o=S(o,_,F)),b)return o;for(var s="",l=o.len…
JSON.rawJSON
// undefined
JSON.rawJSON
// undefined
const params = {"cfgType": "bpmn_sort", "cfgCode": "xms-todo", "1": "1", "0": "0"}
// undefined
JSON.stringify(params, ["cfgCode", "cfgType"])
// '{"cfgType":"bpmn_sort","cfgCode":"xms-todo"}'
JSON.stringify(params, ["cfgCode", "cfgType", "1", "0"])
// '{"0":"0","1":"1","cfgType":"bpmn_sort","cfgCode":"xms-todo"}'
JSON.stringify(params)
'{"0":"0","1":"1","cfgType":"bpmn_sort","cfgCode":"xms-todo"}'

Activity

  1. added a commit that references this issue on Aug 1, 2026
    2507115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions