Datatype: JSON#

A JSON file stores simple data structures and objects in Javascript.#

In this example, we are using the LifeZone_moja.json file.

Viewing a JSON file can be very simple, and we don’t need any external library or dependencies.

Go through the given steps to open a JSON file in a jupyter notebook:

  1. Import the JSON module

import json
  1. Copy the file path of your JSON file and pass it as a parameter to the open() method

with open("LifeZone_moja.json") as f:
      data = json.load(f)
data
{'layer_type': 'GridLayer',
 'layer_data': 'Byte',
 'nodata': 255,
 'tileLatSize': 1.0,
 'tileLonSize': 1.0,
 'blockLatSize': 0.1,
 'blockLonSize': 0.1,
 'cellLatSize': 0.01,
 'cellLonSize': 0.01,
 'attributes': {'1': 'Tropical Dry',
  '2': 'Tropical Moist',
  '3': 'Tropical Premontane Wet, Transition to Basal - Pacific'}}

You can now view the JSON data.