JSON examples for DEVELOPERS

Here I’ll show you different ways in how JSON is used in real-life scenarios. Whether you need to access third-party data or provide a means for exchanging data between different systems, you’ll find that JSON fits perfectly in all these situations.


1. YouTube API JSON Response (partial results):

{  "kind": "youtube#searchListResponse",  "etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/PaiEDiVxOyCWelLPuuwa9LKz3Gk\"",  "nextPageToken": "CAUQAA",  "regionCode": "KE",  "pageInfo": {    "totalResults": 4249,    "resultsPerPage": 5  },  "items": [    {      "kind": "youtube#searchResult",      "etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/QpOIr3QKlV5EUlzfFcVvDiJT0hw\"",      "id": {        "kind": "youtube#channel",        "channelId": "UCJowOS1R0FnhipXVqEnYU1A"      }    },    {      "kind": "youtube#searchResult",      "etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/AWutzVOt_5p1iLVifyBdfoSTf9E\"",      "id": {        "kind": "youtube#video",        "videoId": "Eqa2nAAhHN0"      }    },    {      "kind": "youtube#searchResult",      "etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/2dIR9BTfr7QphpBuY3hPU-h5u-4\"",      "id": {        "kind": "youtube#video",        "videoId": "IirngItQuVs"      }    }  ]}

2. Twitter API JSON Response

[{  "created_at": "Thu Jun 22 21:00:00 +0000 2017",  "id": 877994604561387500,  "id_str": "877994604561387520",  "text": "Creating a Grocery List Manager Using Angular, Part 1: Add &amp; Display Items https://t.co/xFox78juL1 #Angular",  "truncated": false,  "entities": {    "hashtags": [{      "text": "Angular",      "indices": [103, 111]    }],    "symbols": [],    "user_mentions": [],    "urls": [{      "url": "https://t.co/xFox78juL1",      "expanded_url": "http://buff.ly/2sr60pf",      "display_url": "buff.ly/2sr60pf",      "indices": [79, 102]    }]  },  "source": "<a href=\"http://bufferapp.com\" rel=\"nofollow\">Buffer</a>",  "user": {    "id": 772682964,    "id_str": "772682964",    "name": "SitePoint JavaScript",    "screen_name": "SitePointJS",    "location": "Melbourne, Australia",    "description": "Keep up with JavaScript tutorials, tips, tricks and articles at SitePoint.",    "url": "http://t.co/cCH13gqeUK",    "entities": {      "url": {        "urls": [{          "url": "http://t.co/cCH13gqeUK",          "expanded_url": "http://sitepoint.com/javascript",          "display_url": "sitepoint.com/javascript",          "indices": [0, 22]        }]      },      "description": {        "urls": []      }    },    "protected": false,    "followers_count": 2145,    "friends_count": 18,    "listed_count": 328,    "created_at": "Wed Aug 22 02:06:33 +0000 2012",    "favourites_count": 57,    "utc_offset": 43200,    "time_zone": "Wellington",  },}]

3. Local REST JSON File

{  "total": 25,  "limit": 10,  "skip": 0,  "data": [{    "_id": "5968fcad629fa84ab65a5247",    "first_name": "Sabrina",    "last_name": "Mayert",    "address": "69756 Wendy Junction",    "phone": "1-406-866-3476 x478",    "email": "donny54@yahoo.com",    "updatedAt": "2017-07-14T17:17:33.010Z",    "createdAt": "2017-07-14T17:17:33.010Z",    "__v": 0  }, {    "_id": "5968fcad629fa84ab65a5246",    "first_name": "Taryn",    "last_name": "Dietrich",    "address": "42080 Federico Greens",    "phone": "(197) 679-7020 x98462",    "email": "betty_schaefer1@gmail.com",    "updatedAt": "2017-07-14T17:17:33.006Z",    "createdAt": "2017-07-14T17:17:33.006Z",    "__v": 0  },  ...  ]}

4. JSON Server Example

{  "clients": [    {      "id": "59761c23b30d971669fb42ff",      "isActive": true,      "age": 36,      "name": "Dunlap Hubbard",      "gender": "male",      "company": "CEDWARD",      "email": "dunlaphubbard@cedward.com",      "phone": "+1 (890) 543-2508",      "address": "169 Rutledge Street, Konterra, Northern Mariana Islands, 8551"    },    {      "id": "59761c233d8d0f92a6b0570d",      "isActive": true,      "age": 24,      "name": "Kirsten Sellers",      "gender": "female",      "company": "EMERGENT",      "email": "kirstensellers@emergent.com",      "phone": "+1 (831) 564-2190",      "address": "886 Gallatin Place, Fannett, Arkansas, 4656"    },    {      "id": "59761c23fcb6254b1a06dad5",      "isActive": true,      "age": 30,      "name": "Acosta Robbins",      "gender": "male",      "company": "ORGANICA",      "email": "acostarobbins@organica.com",      "phone": "+1 (882) 441-3367",      "address": "697 Linden Boulevard, Sattley, Idaho, 1035"    }  ]}

5. Example Google Maps JSON File

{  "markers": [    {      "name": "Rixos The Palm Dubai",      "position": [25.1212, 55.1535],    },    {      "name": "Shangri-La Hotel",      "location": [25.2084, 55.2719]    },    {      "name": "Grand Hyatt",      "location": [25.2285, 55.3273]    }  ]}

6. Example Colors JSON File

{  "colors": [    {      "color": "black",      "category": "hue",      "type": "primary",      "code": {        "rgba": [255,255,255,1],        "hex": "#000"      }    },    {      "color": "white",      "category": "value",      "code": {        "rgba": [0,0,0,1],        "hex": "#FFF"      }    },    {      "color": "red",      "category": "hue",      "type": "primary",      "code": {        "rgba": [255,0,0,1],        "hex": "#FF0"      }    },    {      "color": "blue",      "category": "hue",      "type": "primary",      "code": {        "rgba": [0,0,255,1],        "hex": "#00F"      }    },    {      "color": "yellow",      "category": "hue",      "type": "primary",      "code": {        "rgba": [255,255,0,1],        "hex": "#FF0"      }    },    {      "color": "green",      "category": "hue",      "type": "secondary",      "code": {        "rgba": [0,255,0,1],        "hex": "#0F0"      }    },  ]}

7. WordPress JSON Example

[  {      "id": 157538,      "date": "2017-07-21T10:30:34",      "date_gmt": "2017-07-21T17:30:34",      "guid": {          "rendered": "https://www.hello.com/?p=157538"      },      "modified": "2017-07-23T21:56:35",      "modified_gmt": "2017-07-24T04:56:35",      "slug": "why-the-iot-threatens-your-wordpress-site-and-how-to-fix-it",      "status": "publish",      "type": "post",      "link": "https://www.hello.com/why-the-iot-threatens-your-wordpress-site-and-how-to-fix-it/",      "title": {          "rendered": "Why the IoT Threatens Your WordPress Site (and How to Fix It)"      },      "content": {         ...      },      "excerpt": {          ...      },      "author": 72546,      "featured_media": 157542,      "comment_status": "open",      "ping_status": "closed",      "sticky": false,      "template": "",      "format": "standard",      "meta": [],      "categories": [          6132      ],      "tags": [          1798,          6298      ],      }  ]

8. GeoIP JSON Example

{  "as": "AS16509 Amazon.com, Inc.",  "city": "Boardman",  "country": "United States",  "countryCode": "US",  "isp": "Amazon",  "lat": 45.8696,  "lon": -119.688,  "org": "Amazon",  "query": "54.148.84.95",  "region": "OR",  "regionName": "Oregon",  "status": "success",  "timezone": "America\/Los_Angeles",  "zip": "97818"}

9. Database JSON File

[{  "_id": {    "$oid": "5968dd23fc13ae04d9000001"  },  "product_name": "sildenafil citrate",  "supplier": "Wisozk Inc",  "quantity": 261,  "unit_cost": "$10.47"}, {  "_id": {    "$oid": "5968dd23fc13ae04d9000002"  },  "product_name": "Mountain Juniperus ashei",  "supplier": "Keebler-Hilpert",  "quantity": 292,  "unit_cost": "$8.74"}, {  "_id": {    "$oid": "5968dd23fc13ae04d9000003"  },  "product_name": "Dextromathorphan HBr",  "supplier": "Schmitt-Weissnat",  "quantity": 211,  "unit_cost": "$20.53"}]

10. Test Data JSON Example

[{  "id": 1,  "first_name": "Jeanette",  "last_name": "Penddreth",  "email": "jpenddreth0@census.gov",  "gender": "Female",  "ip_address": "26.58.193.2"}, {  "id": 2,  "first_name": "Giavani",  "last_name": "Frediani",  "email": "gfrediani1@senate.gov",  "gender": "Male",  "ip_address": "229.179.4.212"}, {  "id": 3,  "first_name": "Noell",  "last_name": "Bea",  "email": "nbea2@imageshack.us",  "gender": "Female",  "ip_address": "180.66.162.255"}, {  "id": 4,  "first_name": "Willard",  "last_name": "Valek",  "email": "wvalek3@vk.com",  "gender": "Male",  "ip_address": "67.76.188.26"}]


Reference: wikipedia: https://en.wikipedia.org/wiki/JSONjson Official:http://json.org/examplesitepoint: https://www.sitepoint.com/10-example-json-files/