Solved

what is difference between Javascript and JSON?

Posted on 2014-02-03
3
376 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
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 52

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to count occurrences of each item in an array.

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now