Facebook App dev vol.6 : Adding JSON Data Feeds

Note from : Building Facebook Applications with HTML and JavaScript Ch.4 – 1

JSON : JavaScript Object Notation

– User data in the Open Graph is stored in a format called JSON

– It’s a way to describe data so that JavaScript can easily interpret it.

– It’s easier to parse than XML, but harder to read, especially when minified.

– Companies like Facebook, Twitter and Google provide access to their data in JSON format

– Facebook JavaScript SDK relies heavily on JSON

– a JSON object is wrapped with a curly bracket

– Inside of curly bracket, there is a string usually a variable name and a value separated by a colon
{ string : value }

– You can specify more than one element in the object by separating them with commas. (nested)
{ string1 : value1 , string2 : value2, string3 : value3 }

– Left side String, a variable name is a sequence of characters in quotes like a C string

– Use \ character if you need to escape strings

– Right side Value can be lots of different things including nesting objects inside other objects, an array.

Example JSON object

– Although JSON works well with JavaScript, there are a number of PHP functions that can easily parse JSON data.

– JSON is a wonderful tool for JavaScript, when you format data in this manner, it will be parsed, and it’ll be easier to use in the app.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s