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 8468549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:57:58+00:00 2026-06-10T15:57:58+00:00

Does anyone have a good solution for storing Parse.com objects into localStorage for Javascript

  • 0

Does anyone have a good solution for storing Parse.com objects into localStorage for Javascript projects?

The problem I have come across is that when converting the object to JSON, we lose the id on the object. This is because the id in Parse.com objects isn’t stored in the attributes.
Give me some hint.
Thanks in Advance.

Update
My little example

var Something = Parse.Object.extend("Something");
var something = new Something();
something.set("attribute1", "attribute1");
something.save(null, {
        success: function(obj) {
            something.fetch({
                success: function(obj) {
                    console.log("object:"); console.log(obj); 
                    console.log("json:");     console.log(JSON.stringify(obj));
                },
            })
        },
    })

Which give this output:

object: appmob.js:1563
d.hasOwnProperty.f
_changing: false
_escapedAttributes: Object
_existed: true
_hasData: true
_hashedJSON: Object
_opSetQueue: Array[1]
_pending: Object
_previousAttributes: Object
_saving: false
_serverData: Object
_silent: Object
attributes: Object
changed: Object
cid: "c0"
createdAt: Mon Sep 03 2012 15:43:50 GMT+1000 (EST)
id: "e419YJmhR5"
updatedAt: Mon Sep 03 2012 15:43:50 GMT+1000 (EST)
__proto__: c

** which has the id.

json: 
{"attribute1":"attribute1","attribute2":"attribute2"} 

** which doesn’t have the id.

This is related to this stackoverflow question
Backbone model .toJSON() doesn't render all attributes to JSON

So I was wondering what would be the simplest way to store the JSON string into localstorage.

  • 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-10T15:58:00+00:00Added an answer on June 10, 2026 at 3:58 pm

    Ok, so from what I can tell (see comments above), the native JS API for Parse assumes you only want to serialize the attributes (ie core data) of objects and NOT the actual metadata, including ID, created, etc. Since they really want you to store stuff ONLY on their system, this makes sense. However, you can write your own code to handle this yourself. For example, this method below grabs two metadata keys (id and createdAt, there IS more, but I was just testing) and creates a key called ‘data’ for the core attributes.

    function serializeParseObject(pob) {
      var ob = {};
      ob.id = pob.id;
      ob.createdAt = pob.createdAt;
      ob.data = pob.attributes;
      return JSON.stringify(ob);
    }
    

    I tested this a sample result object and it worked ok. Again though you probably want to add the other metadata keys for completeness. (Or maybe you only care about id.)

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

Sidebar

Related Questions

Does anyone have a good solution for integrating some C# code into a java
Does anyone have a good solution for testing mobile websites in Visual Studio 2010?
Does anyone have a good solution for getting and setting variables in window.location.hash ?
DOes anyone have any good information with regards to when to log, I was
Does anyone have a good VBA way (or perhaps there is an MS Word
Does anyone have a good way of deleting duplicate transactions (same date, amount, biller,
Does anyone have any good advice or experience on how to create an engine
Does anyone have a good Drupal upgrade strategy for an install that is in
Does anyone have any good samples, resources, pointers etc. for C# Silverlight with RIA
Does anyone have a good explanation why the ? extends syntax has to be

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.