Recently, ESET add my domain name to the black-list of their database. You can’t open my site and been warned my site is not safe if your PC is running the ESS or EAV. Why Eset block my site?The answer is obvious. That is reason that you come here. I promise that my site is pure, no virus, no spyware, no Trojan, no pop ads. You can test my word through intalling Kaspersky or other Antivirus Software. If you want open my site and take latest escalation ID & Activation Code, close your ESET software(disable antivirus and antispyware protection function temporarily) or by proxy or virtual machinor. You can also feed the RSS source http://feed.loserblog.cn.
Home > Programm > JSON Technology

JSON Technology

XML – that for this client and server for data exchange between the payload format has become almost a synonym for Web services. We know that AJAX technology would be able to request a faster every time, every time the request is not the return of the entire pages, and only by the need to return to the data. However, due to Ajax and REST the emergence of technology applications affect the structure, which forced people began to seek `XML as a substitute for, such as: JavaScript Object Notation (JSON).

JSON as a lighter, more friendly Web services client format (use of the browser in the form or visit the REST style Web services Ajax application form) from the Web service provider's attention. AJAX usually by returning the data in XML format, and then through the client complex JavaScript script analysis and rendering of these data in XML format. JSON (Reading Jason) can make is to become a standard data format, was more simple JavaScript Analysis.

This paper will set out JSON Web services in the design of the reasons for the highly respected, and XML as an alternative to the main advantages and limitations. In-depth study will be: With the corresponding Web service clients choose to use JSON, how can we easily in Java Web services generated in the JSON output.
json official documents: http://www.json.org/json-zh.html

JSON the merits of


     * Lightweight data interchange format
     * People to read and write more easily
     * Analysis and the machine easy to generate
     * Through JavaScript in eval () function analytical JSON
     * JSON support multi-language. Including: ActionScript, C, C #, ColdFusion, E, Java, JavaScript, ML, Objective CAML, Perl, PHP, Python, Rebol, Ruby, and Lua.


JSON syntax is a generation and transmission of data for the agreement, is very similar to C family of languages, can easily be C family of languages by the analytical.
Target: object contains again between ()
Attributes: Key-Value on to express. Use a comma between the separate attributes. string: value
Array: storage array to [] and [elements]
Elements: element with commas separate
Value: value can be string figures, objects, arrays, true, false, null

Examples:
JSON
( "menu": (
     "id": "file",
     "value": "File:",
     "popup": (
       "menuitem": [
         ( "value": "New", "onclick": "CreateNewDoc ()"},
         ( "value": "Open", "onclick": "OpenDoc ()"},
         ( "value": "Close", "onclick": "CloseDoc ()")]
     )
))
XML
<menu id="file" value="File">
     <popup>
       <menuitem value="New" onclick="CreateNewDoc()" />
       <menuitem value="Open" onclick="OpenDoc()" />
       <menuitem value="Close" onclick="CloseDoc()" />
     </ popup>
</ menu>
XML is the role of formatted data content. If we do not have to XML what better way? » The answer is JSON. JSON before I first introduced about this door JavaScript scripting language. Scripting language has its own dynamic implementation of the gifted. That we can to implement the statement on the string, through the eval () function to the implementation of this dynamic implementation. The contents of the string, we would like to write the script was executed the same.
<HTML>
<HEAD>
<TITLE> Eval example 1 </ TITLE>
</ HEAD>
<BODY>
<script>
Str = "alert ( 'hello')";
Eval (str);
</ Script>
</ BODY>
</ HTML>
Pages will open the pop-up window hello. We can put any strings in the script statements, including statements statement, and so on a number of things, such as:
<HTML>
<HEAD>
<TITLE> Eval example 2 </ TITLE>
</ HEAD>
<BODY>
<script>
define = "(name: 'Michael', email:'17bity @ gmail.com ')";
Eval ( "data =" + define);
Alert ( "name:" + data.name);
Alert ( "email:" + data.email);
</ script>
</ BODY>
</ HTML>
If we came in the background Asynchronous JavaScript is the text of the statement language, not an eval method will be able to resolve the » For analytical complex XML, this is the efficiency of how great the increase ah! Now to tell you what is JSON: JavaScript Object Notation. I am more willing to translate it for the JavaScript object statement. For example, from the background information contained in a number of contacts, if written in XML, as follows:
<contact>
<friend>
<name> Michael </ name>
<email> 17bity@gmail.com </ email>
<homepage> Http://www.jialing.net </ homepage>
</ Friend>
<friend>
<name> John </ name>
<email> John@gmail.com </ email>
<homepage> Http://www.john.com </ homepage>
</ Friend>
<friend>
<name> Peggy </ name>
<email> Peggy@gmail.com </ email>
<homepage> Http://www.peggy.com </ homepage>
</ Friend>
</ contact>
JSON and wrote it, as the following:
[
(
Name: "Michael",
Email: "17bity@gmail.com",
Homepage: "http://www.jialing.net"
)
(
Name: "John",
Email: "john@gmail.com",
Homepage: "http://www.jobn.com"
)
(
Name: "Peggy",
Email: "peggy@gmail.com",
Homepage: "http://www.peggy.com"
)
]
Not just a simple e­xpression, the most important thing is to be discarded people confused the analysis of the DOM. Because as long as the JavaScript statement norms, JavaScrip will automatically help you resolve good. Ajax in the use of JSON is the basic outlook statement printed in the background object of JavaScript string, and ways to eval it to the actual object, final adoption of DHTML updated information pages.


Categories: Programm Tags:
  1. No comments yet.
  1. No trackbacks yet.
  • Partner links