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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:53:09+00:00 2026-05-11T08:53:09+00:00

On JSON.org the essential data structures that JSON represents are given as A collection

  • 0

On JSON.org the essential data structures that JSON represents are given as

  1. A collection of name/value pairs, and
  2. An ordered list of values.

I have not been able to find anywhere whether a second member having the same name as one already parsed into the current object should (a) throw an exception or (b) replace the existing member.

Is this specified anywhere?

What do existing parsers do with repeated names?

EDIT: I am looking to define correct behavior for my parser.

  • 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. 2026-05-11T08:53:10+00:00Added an answer on May 11, 2026 at 8:53 am

    JSON is simply a subset of the object literal notation of JavaScript and as such, is constrained by the same rules – the latest value for repeated keys will override any previously assigned value for that key, within the specific object. Think in terms of assigning a value to an object property; A later assignment will override an earlier one.

    To demonstrate this, I have set up an example here. The code is displayed on the page, and as can be seen, the messagebox has the name ‘Barney’ in it.

    Code here –

    $(function() {      $('#myButton').click(function(e)       {      var myJsonString =  'Person = {'firstName':'Fred','lastName':'Flintstone','firstName':'Barney'}';      eval('(' + myJsonString + ')');      alert(Person.firstName);      });  }); 

    By the Way, I have used eval() here for ease of use. I would recommend using a JSON parser instead of eval() due to security issues.

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

Sidebar

Ask A Question

Stats

  • Questions 197k
  • Answers 197k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you're worried about performance...profile. Otherwise you can't go wrong… May 12, 2026 at 7:26 pm
  • Editorial Team
    Editorial Team added an answer Set the div to 480px wide and put the 10px… May 12, 2026 at 7:26 pm
  • Editorial Team
    Editorial Team added an answer IMO, this is the responsibility of the build system, not… May 12, 2026 at 7:26 pm

Related Questions

Could you please tell me, what is the use of JSON (in Javascript and
I have a test case of a problem I'm having, basically I create a
I went to http://www.json.org/js.html and downloaded the json2.js, thinking i'd be fine, afterall that
I ‘m trying to make an Ajax call to an aspx page On the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.