Solved

what is difference between Javascript and JSON?

Posted on 2014-02-03
3
437 Views
Last Modified: 2014-02-05
Can anyone please tell me what is difference between Javascript and JSON?
What are the benefits of JSON over Javascript? When should I be using one over the other?
0
Comment
Question by:RajG1978
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 250 total points
ID: 39831499
JSON is a language independent data interchange format most commonly used as an alternative to XML.

While JSON objects are based on the Javascript object literal they are not the same.

to summarize JSON is a data interchange format, javascript is most commonly used a client-side scripting language although it can also be used on the server-side.

http://msdn.microsoft.com/en-us/library/bb299886.aspx
0
 
LVL 11

Assisted Solution

by:MajorBigDeal
MajorBigDeal earned 250 total points
ID: 39831501
Javascript is an implementation of a programming language (EcmaScript)

JSON is format for exchanging data. It is based on Javascript but it's purpose is as a format for exchanging data not to write programs.

So Javascript is in the programming language category, like C# for example.  JSON is in the data-exchange format category, like XML for example.
0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39831949
Are you asking about a javascript array vs json?  I think they get confused a lot.
array
var beer=["Dunkel-weizens","Porters","Stout"];

Open in new window

vs json
{
    "beer": [
        {
            "style": "Dunkel-weizens"
        },
        {
            "style": "Porters"
        },
        {
            "style": "Stout"
        }
    ]
}

Open in new window


With an array you select items by their index 0,1,2.  With json, you can use the names beer or style.  

Do you have a particular use case?
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Changing the format from a text box to a drop-down menu 9 36
Google Chrome: Debugging AJAX call 6 38
modify font on ninja form 1 21
script to read text file 34 27
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question