Solved

what is difference between Javascript and JSON?

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
This video teaches users how to migrate an existing Wordpress website to a new domain.

746 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