Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Reading JSON files
6. JSON with logical values
Summary and Review


Great! We now know that the data in a JSON file looks like this:

  "first_name": "Emma",
  "last_name": "Jones",
  "age": 43,
  "is_manager": true

After we load this JSON file into Python, we'll get a corresponding Python dictionary:

  'first_name': 'Emma',
  'last_name': 'Jones',
  'age': 43,
  'is_manager': True

Any logical value in JSON is loaded as the corresponding logical value in Python. We can test the logical values from JSON in the same way as any other logical value in Python:

if not employee['is_manager']:
  print('This is not a manager')


Check if customer2 is a VIP. Use the is_VIP field. If customer2 is a VIP, print:

This client is a VIP.