Chap 7
Wow, new blogger with Google sucks. I just finished the chapter 7 summary, but it logged me out after a little and erased all I had written. Here goes to re-summarizing.
This chapter discusses the differences between XML and JSON.
You work with XML using DOM while you work with JSON using "normal" JavaScript. Hence, you don't need a special object mode to work with JSON data.
The easier use JSON helps with is utilizing arrays.
The great thing about JSON is that it's JavaScript, so it uses JSON easily.
The bad thing is that since it's JavaScript, PHP, Perl, and Java can't understand JSON without libraries.
You'll need a new Services_JSON object to handle encoding a JSON response in PHP.
When servers respond with JSON, they send the data across as text. So you need to use the responseText property of request object to get the JSON data. But JSON is meant to be used in JavaScript as an object, so you've got to convert it from text to its object form. You can do this using JavaScript's eval() function.
You can find libraries at www.json.org.
JSON works great with objects, but not all sites need objects. You should use text data for your requests whenever possible.
Ultimately, the choice is yours whether you want to use XML or JSON.
This chapter discusses the differences between XML and JSON.
You work with XML using DOM while you work with JSON using "normal" JavaScript. Hence, you don't need a special object mode to work with JSON data.
The easier use JSON helps with is utilizing arrays.
The great thing about JSON is that it's JavaScript, so it uses JSON easily.
The bad thing is that since it's JavaScript, PHP, Perl, and Java can't understand JSON without libraries.
You'll need a new Services_JSON object to handle encoding a JSON response in PHP.
When servers respond with JSON, they send the data across as text. So you need to use the responseText property of request object to get the JSON data. But JSON is meant to be used in JavaScript as an object, so you've got to convert it from text to its object form. You can do this using JavaScript's eval() function.
You can find libraries at www.json.org.
JSON works great with objects, but not all sites need objects. You should use text data for your requests whenever possible.
Ultimately, the choice is yours whether you want to use XML or JSON.

0 Comments:
Post a Comment
<< Home