yaml vs json vs xml

yaml vs json vs xml

———xml
<?xml version=”1.0” encoding=”UTF-8” ?>
John
Smith
male
25


21 2nd Street
New York
NY
10021


home
212 555-1234


fax
646 555-4567

———json
{
“firstName”: “John”,
“lastName”: “Smith”,
“sex”: “male”,
“age”: 25,
“address”:
{
“streetAddress”: “21 2nd Street”,
“city”: “New York”,
“state”: “NY”,
“postalCode”: “10021”
},
“phoneNumber”:
[
{
“type”: “home”,
“number”: “212 555-1234”
},
{
“type”: “fax”,
“number”: “646 555-4567”
}
]
}

——yaml

firstName: John
lastName: Smith
sex: male
age: 25
address:
streetAddress: 21 2nd Street
city: New York
state: NY
postalCode: 10021
phonenumber:

- type: home
  number: 646 555-4567
- type: fax
  number: 212 555-1234

—– pyton dict class
{‘address’: {‘city’: ‘New York’,
‘postalCode’: 10021,
‘state’: ‘NY’,
‘streetAddress’: ‘21 2nd Street’},
‘age’: 25,
‘firstName’: ‘John’,
‘lastName’: ‘Smith’,
‘phonenumber’: [{‘number’: ‘646 555-4567’, ‘type’: ‘home’},
{‘number’: ‘212 555-1234’, ‘type’: ‘fax’}],
‘sex’: ‘male’}