This document provides you with some JSON Example. Examples are associated with XML, MySQL, MongoDB and APIs to add more value. Instead of just writing the JSON code as examples, we thought that it would be of more value to you if we co-relate the examples with those.
If you want to read about various formats JSON can be stored with, you may refer JSON Data Structure.
The following is an example of a JSON document. Bellow that. the XML format of the same document is given.
All of the JSON documents used in this document are validated with JSONLint.
The following is a MySQL table. Using the PHP-MySQL code bellow the table, we have created a JSON document.
PHP MySQL code to extract data from MySQL table and display as JSON.
The following example shows how MongoDB stores data in JSON format. We have a table called 'userdetails' and if we run a query to select all the records of
the table, we get data in JSON format.
tumblr.com is a messaging platform. It offers an API to retrieve data. Here is a simple command to retrieve blog information. For the sake of simplicity, we have kept authentication method out of the scope of this document.
Where "web-development-and-seo" is the blog name from where you want to retrieve data. When the browser is pointed to this URL, we get following output, which is in JSON format.
Solve these problems: