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

  • SEARCH
  • Home
  • 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 6370595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:57:02+00:00 2026-05-25T00:57:02+00:00

In my web app, I’m serializing objects for storage using JSON.stringify() as described here

  • 0

In my web app, I’m serializing objects for storage using JSON.stringify() as described here. This is great, and I can easily re-create the objects from the JSON strings, but I lose all of the objects’ methods. Is there a simple way to add these methods back to the objects that I’m overlooking – perhaps involving prototyping, something I’m not overly familiar with?

Or is it just a case of creating an elaborate function of my own for doing this?

Edit: Ideally, I’m looking for something like:

Object.inheritMethods(AnotherObject);
  • 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-05-25T00:57:03+00:00Added an answer on May 25, 2026 at 12:57 am

    Once you have your object after calling JSON.parse, you have many options. Here’s a few examples.

    1. Mixin

      There are many techniques for doing this, which this article describes nicely. However, here’s a simple example that doesn’t require any new language features. Remember that an object is essentially just a map, so JS makes it easy to add additional properties to an object.

      var stuffToAdd = function() {
          this.name = "Me";        
      
          this.func1 = function() {
              print(this.name);
          }
      
          this.func2 = function() {
              print("Hello again");
          }
      }
      
      var obj = JSON.parse("{}");
      stuffToAdd.call(obj);
      
    2. Prototypical

      Use the Object.create method that Felix mentioned. Since this is only offered in ES5, you may want to use a shim to guarantee its availability.

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

Sidebar

Related Questions

My web app has been chugging along just great in Production for years with
Web app. Get data from services in json & xml formats. And from internal
My web app, up until this point, has been fairly straight forward. I have
I'm writing a web app that inserts and modifies HTML elements via AJAX using
A web app that I'm writing throws this compiletime error Error 1 The type
My web-app has this secret place only some people are allowed to use. When
Our web app currently under development has authentication on all the pages. We can
Im with my first web app and this is my first deploy. All is
We have a C# web app where users will connect using a digital certificate
So part of my web app centers around this very important form which is

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.