Javascript Object Notation (JSON)
Creating data sets
NAME | |
---|---|
fulano | fulano@gmail.com |
sicrano | sicrano@gmail.com |
Comma Separated Values (CSV)
name, email
fulano, fulano@gmail.com
sicrano, sicrano@gmail.com
eXtensible Markup Language (XML)
<students>
<student>
<name>Fulano</name>
<email>fulano@gmail.com</email>
</student>
<student>
<name>Sicrano</name>
<email>sicrano@gmail.com</email>
</student>
</students>
YAML Ain’t Markup Language (YAML)
Reference: doc
- name: 'fulano'
email: 'fulano@gmail.com'
- name: 'sicrano'
email: 'sicrano@gmail.com'
Javascript Object Notation (JSON)
Reference: JSON ORG
Quoted (.json, .js)
[
{
"name": "fulano",
"email": "fulano@gmail.com",
},
{
"name": "sicrano",
"email": "sicrano@gmail.com",
}
]
Unquoted (.js)
const students = [
{
name: 'fulano',
email: 'fulano@gmail.com',
},
{
name: 'sicrano',
email: 'sicrano@gmail.com',
},
];
Indexed & Unquoted (.js)
const students = {
20181234: {
name: 'fulano',
email: 'fulano@gmail.com'
},
20181235: {
name: 'sicrano',
email: 'sicrano@gmail.com'
}
}
References:
Web API
APIs: Any API, abhishekbanthia/Public-APIs, toddmotto/public-apis
Via CEP API
Reference: doc
https://viacep.com.br/ws/01001000/json/:
{
"cep": "01001-000",
"logradouro": "Praça da Sé",
"complemento": "lado ímpar",
"bairro": "Sé",
"localidade": "São Paulo",
"uf": "SP",
"unidade": "",
"ibge": "3550308",
"gia": "1004"
}
IP API
http://ip-api.com/json/8.8.8.8:
{
"as":"AS15169 Google Inc.",
"city":"Mountain View",
"country":"United States",
"countryCode":"US",
"isp":"Google",
"lat":37.4229,"lon":-122.085,"org":"Google",
"query":"8.8.8.8",
"region":"CA",
"regionName":"California",
"status":"success",
"timezone":"America/Los_Angeles",
"zip":""
}
JSONPlaceholder API
Reference: doc
http://jsonplaceholder.typicode.com/posts/:
[
{
userId: 1,
id: 1,
title: 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit',
body:
'quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto',
},
{
userId: 1,
id: 2,
title: 'qui est esse',
body:
'est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla',
},
...{
userId: 10,
id: 100,
title: 'at nam consequatur ea labore ea harum',
body:
'cupiditate quo est a modi nesciunt soluta\nipsa voluptas error itaque dicta in\nautem qui minus magnam et distinctio eum\naccusamus ratione error aut',
},
];