This repository provides the latest Indian states and districts JSON dataset, along with the browser-based scraper code used to generate it. The data is sourced directly from an official Indian government website and includes both the generated JSON file and the scraper code.
Source website: https://igod.gov.in/sg/district/states
Developers commonly search for:
- Indian states and districts JSON
- District list of India in JSON format
- India state district dropdown data
- Indian address data for forms and APIs
Most available datasets are outdated, incomplete, or not traceable to an official source. This repository solves that by enabling direct, reproducible extraction from a government portal.
- Latest available states and districts
- Clean, minimal structure
- Suitable for frontend, backend, APIs, and databases
- Runs directly in the browser console
- No Node.js or dependencies
- No CORS issues
- Can be re-run anytime to refresh data
All data is extracted from the official Indian government portal:
https://igod.gov.in/sg/district/states
This ensures:
- Authentic data
- Verifiable source
- Transparency
- Long-term reliability
[
{
"state": "West Bengal",
"districts": [
"Kolkata",
"Howrah",
"Darjeeling"
]
},
{
"state": "Maharashtra",
"districts": [
"Mumbai",
"Pune",
"Nagpur"
]
}
]- Flat and predictable
- Easy to map to dropdowns
- Simple to extend with codes or metadata
- Language-agnostic
Navigate to:
https://igod.gov.in/sg/district/states
- Windows / Linux:
F12orCtrl + Shift + I - macOS:
Cmd + Option + I
Switch to the Console tab.
Paste the script below into the browser console and press Enter.
(async () => {
const CONCURRENCY = 3; // keep low (gov server)
const STEP = 5;
const result = [];
let index = 0;
const stateLinks = Array.from(
document.querySelectorAll(".state li a")
).map(a => ({
state: a.innerText.trim(),
url: a.href.replace("categories","E042/organizations")
}));
async function scrapeState(current) {
console.log(`Fetching state page: ${current.state}`);
const res = await fetch(current.url);
const html = await res.text();
const doc = new DOMParser().parseFromString(html, "text/html");
const districts = new Set();
// 1️⃣ Extract already loaded districts
doc.querySelectorAll(".search-row .search-title")
.forEach(el => districts.add(el.innerText.trim()));
// 2️⃣ Build AJAX continuation base URL
const urlParts = new URL(current.url).pathname.split("/");
const sg = urlParts[1];
const stateCode = urlParts[2];
const category = urlParts[3];
let start = districts.size;
while (true) {
const ajaxUrl = `/${sg}/${stateCode}/${category}/organizations_more/${start}/5`;
const res2 = await fetch(ajaxUrl, {
credentials: "same-origin",
headers: {
"X-Requested-With": "XMLHttpRequest"
}
});
const moreHTML = await res2.text();
if (!moreHTML || !moreHTML.trim()) {
break;
}
const moreDoc = new DOMParser().parseFromString(moreHTML, "text/html");
const newItems = moreDoc.querySelectorAll(".search-row .search-title");
if (!newItems.length) break;
newItems.forEach(el =>
districts.add(el.innerText.trim())
);
console.log(`${current.state} → fetched ${districts.size}`);
start += STEP;
await new Promise(r => setTimeout(r, 400)); // polite delay
}
console.log(`✔ DONE: ${current.state} (${districts.size})`);
return {
state: current.state,
districts: Array.from(districts)
};
}
async function worker() {
while (index < stateLinks.length) {
const current = stateLinks[index++];
const data = await scrapeState(current);
result.push(data);
}
}
await Promise.all(
Array.from({ length: CONCURRENCY }, worker)
);
// Download JSON
const json = JSON.stringify(result, null, 2);
const blob = new Blob([json], { type: "application/json" });
const downloadUrl = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = downloadUrl;
a.download = "india-states-districts.json";
a.click();
URL.revokeObjectURL(downloadUrl);
console.log("Download complete ✅");
})();Some environments (managed browsers, enterprise devices, hardened profiles) disable paste in DevTools.
In that case:
-
Type this manually in the console:
allow pasting
Press Enter.
-
Paste the script again.
This is a built-in Chrome / Edge safety prompt and is expected behavior.
If paste is completely blocked:
-
Create a new Snippet in DevTools:
- DevTools → Sources → Snippets → New Snippet
-
Paste the code there
-
Right-click → Run
This works even in restricted environments.
The browser will automatically download:
india-states-districts-latest.json
This file reflects the current data at the time of execution.
- Indian address forms
- State and district dropdowns
- Government and civic applications
- College and university projects
- Location-based filtering
- APIs and microservices
- Data analysis and research
Districts and administrative boundaries may change.
To update:
- Visit the source website again
- Re-run the scraper
- Replace the JSON file in the repository
This approach ensures freshness without relying on third parties.
- Data comes directly from a public government source
- No automated crawling or abuse
- Fully transparent extraction logic
- Users should validate data for mission-critical use
MIT License. Free to use, modify, and distribute.
Maintained by Somen Das.
Indian states districts JSON India district list JSON Indian address dataset State district dropdown India Indian geography data Government district data India igod.gov.in districts