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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:33:40+00:00 2026-06-10T02:33:40+00:00

var foo = { a: 1, b: true, c: [1, true, 2] }; Please

  • 0
var foo = { "a": 1, "b": true, c: [1, true, "2"] };

Please correct me if I’m wrong here, but as far as I know, this is a valid json object. But it’s also a javascript object.

Are JSON objects based on the javascript language? Or is it the other way around?

Thanks

  • 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-10T02:33:41+00:00Added an answer on June 10, 2026 at 2:33 am

    “Please correct me if I’m wrong here, but as far as I know, this is a valid json object”

    No.

    “But it’s also a javascript object.”

    yes.

    UPDATE: my original answer continues below, but I missed an important syntax error which is helpfully pointed out by @badunk

    The string

    { "a": 1, "b": true, c: [1, true, "2"] }
    

    is JSON. JSON is just about notation – about which symbols make up valid syntax, and what they mean if they are processed.

    Your code:

    var foo = { "a": 1, "b": true, c: [1, true, "2"] };
    

    ..is a piece of javascript. When this is parsed and processed, the part on the right side of the assignment is called a javascript object literal. That is, a piece of javascript that denotes a literal object. But because it is in fact an object, it is not notation anymore – it is processed into a runtime data structure.

    The term JSON is useful when you’re talking about data exchange, for instance over HTTP. If a HTTP response passes a sting like this:

    { "a": 1, "b": true, c: [1, true, "2"] }
    

    it is valid JSON.
    If that would be interpreted, it would result in a javascript object.

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

Sidebar

Related Questions

I know that JavaScript vars point to a value: var foo = true; //...
var foo=[0]; if(foo) alert('first'); if(foo==true) alert('second'); Tell me please, why the second alert doesn't
I understood how to create events, like that: var evt=document.createEvent('Event'); evt.initEvent('foo',true,true); window.dispatch(evt); Then anyone
var foo = { x: 1, y: (function () { return ++this.x; })() };
I have a object var foo = { jon : {age: 'old', feeling: 'sad'
Now if that isn't a weird question, I don't know what is. But here
I have the following object: Test.Beta.MyObject = function($) { var foo = {}; foo.blah
var arr = [foo,bar,xyz]; arr[arr.indexOf('bar')] = true; Is there an easier way to do
while (foo() == true) { foreach (var x in xs) { if (bar(x) ==
function Foo() { var myPrivateBool = false, myOtherVar; this.bar = function(myOtherVar) { myPrivateBool =

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.