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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:38:59+00:00 2026-05-27T01:38:59+00:00

I want to understand the basic differences clearly between JavaScript object and JSON string.

  • 0

I want to understand the basic differences clearly between JavaScript object and JSON string.

Let’s say I create the following JavaScript variable:

var testObject = {one: 1,"two":2,"three":3};

Question 1. Is the key/property name valid both with/without quotes? (e.g., "one" : 1)

If yes, what is the difference?

Question 2: If I convert the above object using JSON.stringify(testObject), what’s the difference between the original JavaScript object and the JSON?

I feel they are almost the same. Please elaborate on this.

Question 3: For parsing a JSON string, is the method below recommended?

var javascriptObj = JSON.parse(jSonString);
  • 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-27T01:39:00+00:00Added an answer on May 27, 2026 at 1:39 am
    1. Is the key/property name valid both with/without quotes?

    The only time you need to enclose a key in quotes when using Object Literal notation is where the key is a reserved word or contains a special character (if, :, -, etc.). It is worth noting that a key in JSON must be enclosed in double quotes.

    1. If I convert the above object to JSON using var jSonString = JSON.stringify(testObject);, what is the difference between the two (JavaScript obj and JSON)?

    JSON is a data interchange format. It’s a standard which describes how ordered lists and unordered maps, strings, booleans and numbers can be represented in a string. Just like XML and YAML is a way to pass structured information between languages, JSON is the same. A JavaScript object on the other hand is a physical type. Just like a PHP array, a C++ class/ struct, a JavaScript object is a type internal to JavaScript.

    Here’s a story. Let’s imagine you’ve purchased some furniture from a store, and you want it delivered. However the only one left in stock is the display model, but you agree to buy it.

    In the shop, the chest-of-drawers you’ve purchased is a living object:

        var chestOfDrawers = {
            color: "red",
            numberOfDrawers: 4
        }
    

    However, you can’t send a chest-of-drawers in the post, so you dismantle it (read, stringify it). It’s now useless in terms of furniture. It is now JSON. It’s in flat pack form.

        {"color":"red","numberOfDrawers":4}
    

    When you receive it, you then rebuild the chest-of-drawers (read, parse it). It’s now back in object form.

    The reason behind JSON, XML and YAML is to enable data to be transferred between programming languages in a format both participating languages can understand; you can’t give PHP or C++ your JavaScript object directly; because each language represents an object differently under-the-hood. However, because we’ve stringified the object into JSON notation; i.e., a standardised way to represent data, we can transmit the JSON representation of the object to another language (C++, PHP), they can recreate the JavaScript object we had into their own object based on the JSON representation of the object.

    It is important to note that JSON cannot represent functions or dates. If you attempt to stringify an object with a function member, the function will be omitted from the JSON representation. A date will be converted to a string;

        JSON.stringify({
            foo: new Date(),
            blah: function () {
                alert('hello');
            }
        }); // Returns the string "{"foo":"2011-11-28T10:21:33.939Z"}"
    
    1. For parsing a JSON string, is the method below recommended? var javascriptObj = JSON.parse(jSonString);

    Yes, but older browsers don’t support JSON natively (before Internet Explorer 8). To support these, you should include json2.js.

    If you’re using jQuery, you can call jQuery.parseJSON(), which will use JSON.parse() under the hood if it’s supported and will otherwise fallback to a custom implementation to parse the input.

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

Sidebar

Related Questions

I want to understand why Rich Decorators over basic types say Int which has
Given the following basic grammar I want to understand how I can handle comment
I just want to understand why I cannot create a protected enum on C#?
Just want a basic understand of what parts a email message may have. I
I am trying to understand basic OS concepts Want to know if my understanding
I understand the basic syntax of Objective-C, have installed Cygwin, and want to experiment.
I understand the basic and how the workflow works and what not. However, let's
I want to know some basic concepts of assembly language to understand it's architecture
I understand that the idea is to create basic HTTP Requests using GET or
I wrote a basic CrawlSpider in scrapy but I want to understand what 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.