Sunday, December 9, 2007

JSON

JSON is a format for the transmission of data useful to move from one code to another.

The most common example is to move an object or an array from PHP to JavaScript and vice versa. For this, PHP 5 provides two features that make the transfer: json_encode and json_decode. There are classes that offer a similar operation for PHP 4.

The advantage of this notation is transparency and ease with which data is transmitted. XML is an alternative which also presents its advantages. It is preferable to a series of data, if they want to consult with XQuery, but for the transmission of single data, JavaScript syntax is presented simpler.

No comments: