A comprehensive and structured JSON dataset of Sri Lanka's administrative divisions. This repository provides a hierarchical list including Provinces, Districts, and Divisional Secretariats, making it ideal for software applications requiring address validation, location selection, or data analysis.
- Complete Hierarchy: Covers all 9 Provinces, 25 Districts, and their respective Divisional Secretariats.
- Easy to Use: Provided in a standard, lightweight JSON format.
- Open Source: Free for use in commercial and personal projects.
The data is organized hierarchically as follows:
{
"provinces": [
{
"name": "Province Name",
"districts": [
{
"name": "District Name",
"divisional_secretariats": ["Division 1", "Division 2"]
}
]
}
]
}provinces: Array of province objects.name: Name of the Province (e.g., "Western Province").districts: Array of district objects within that province.name: Name of the District (e.g., "Colombo").divisional_secretariats: Array of strings, listing all Divisional Secretariats in that district (e.g., ["Colombo", "Dehiwala", ...]).
You can simply require or import the JSON file into your project.
const sriLankaData = require("./sri-lanka-division-data.json");
// Get all provinces
const provinces = sriLankaData.provinces.map((p) => p.name);
console.log(provinces);
// Get districts in Western Province
const westernDistricts = sriLankaData.provinces
.find((p) => p.name === "Western Province")
.districts.map((d) => d.name);
console.log(westernDistricts);import json
with open('sri-lanka-division-data.json', 'r') as f:
data = json.load(f)
# Print all districts in the dataset
for province in data['provinces']:
for district in province['districts']:
print(f"District: {district['name']}")You can use this data by cloning the repository or downloading the JSON file directly.
git clone https://github.com/sahanRanasingha/Sri-Lanka-Division-Data.gitContributions are welcome! If you find any typos, missing divisions, or outdated information, please feel free to report an issue or submit a pull request.
See CONTRIBUTING.md for detailed instructions on how to contribute.
This project is licensed under the MIT License - see the LICENSE.md file for details.