Introduction

- var emp= {"EmpName":"Chandradev"
- ,
- "EmpCode":"3007"
- }

- {"employees":[
- {"firstName":"Chandradev", "lastName":"Sah"},
- {"firstName":"Rajan", "lastName":"Prasad"},
- {"firstName":"Suraj", "lastName":"Kumar"}
- ]}
Using JSON in JavaScript
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title></title>
- <script type="text/javascript">
- var emp= {"EmpName":"Chandradev"
- ,
- "EmpCode":"3007"
- }
- alert(emp.EmpCode);
- alert(emp.EmpName);
- </script>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- </div>
- </form>
- </body>
- </html>

Advantages of JSON
- JSON is easier to use the alternative of XML
- JSON is a simple data exchange pattern that helps to communicate between JavaScript and server-side technology such as ASP.Net, PHP, JSP, CGI and so on
- JSON is a lightweight data-interchange format
- JSON is language independent
- JSON is "self-describing" and easy to understand
In the .Net world, we can also expose JSON data to the outside using WCF, ASP.Net, and MVC. I will be writing an article on this topic very soon.

K P Singh ChundawatPosted Dec 21, 2014, 1:38 AM
Very good article sir ....and also good Q? by Sam Hobbs sir ...waiting for your reply Chandradev sir
Chandradev PrasadPosted Dec 21, 2014, 1:36 AM
Json doesnot support Schema and Namespace features till now.. But xml support this features.
Sam HobbsPosted Dec 19, 2014, 4:28 PM
What are the dis-advantages of JSON?