Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8112571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:32:53+00:00 2026-06-06T02:32:53+00:00

Some code that I don’t have control over is overriding the global JSON object

  • 0

Some code that I don’t have control over is overriding the global JSON object without checking if it’s already implemented:

var JSON = {
  org: "http://www.JSON.org",
  copyright: "(c)2005 JSON.org",
  license: "http://www.crockford.com/JSON/license.html",
  stringify: function(a, g) {
     ...

The problem is that this version of the JSON parser is very old and has a bug, which is fouling up my attempts at serialization. (Others have had a similar problem with this implementation.)

Can I get at the browser’s native implementation? I thought delete would work, but it doesn’t. I suspect that’s because JSON is an object and not a method in the prototype. Is there some other way to get at it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:32:55+00:00Added an answer on June 6, 2026 at 2:32 am

    You can create an iframe element (which will load about:blank and hence create a new context) and get a JSON object from there.

    function restoreJSON() {
      var f = document.createElement("iframe");
      f.style.display = "none";
      document.documentElement.appendChild(f);
      window.JSON = f.contentWindow.JSON;
      document.documentElement.removeChild(f);
    }
    

    about:blank is loaded synchronously, so no need to wait for the load event. While this isn’t restoring the original JSON object, it is getting one black-box identical to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have some code that will take a TimeZoneInfo field from .NET and
I have some code that sets up a dictionary with some defualt values for
I have some code that gets the current logged in user. userID = request.session.get(_auth_user_id)
I have some code that is using SyncEnumerator. As you can see here ,
I frequently have some code that should be run either on a schedule or
I have some code that locates all the contact folders that a user has
I have some code that looks like the following. First I have some domain
Here is some simplified code that I don't understand why it does not work.
I have some IO code that reads a stream within a try..catch. It catches
I have some code that is using mechanize and a password protected site. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.