9.4. Passing Data

The X in AJAX is for XML, and indeed many Web services today use XML for sending and receiving data. XML parsers are readily available in the browser, and classes for creating, manipulating, and serializing XML data on the server are plentiful. XML has also been the foundation for the creation of applications that leverage service-oriented architectures to produce mashup-style applications.

As developers have recognized the potential for passing data between client and server using XML, they have also recognized that XML is not always the ideal format for working with data. This section discusses JavaScript Object Notation (JSON), which is a JavaScript-friendly method of serializing data that has less overhead than XML.

9.4.1. Serialization

Serialization is the process of encoding data in a way that allows it to be sent over a serial connection, such as an HTTP channel, that allows it to be understood on the other side of the connection and can then be deserialized back into its original form. This is commonly used with structured types, since simple types such as strings are inherently compatible with serial channels. When objects are held in memory by a single application, there isn't a need to serialize them. It doesn't really matter how the computer represents them in memory as long as the fields, properties, and methods behave as expected. But when objects need to cross process or machine boundaries, serialization becomes essential in order for that object ...

Get Professional ASP.NET 3.5 AJAX now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.