GeoJSON to TypeScript
Coordinate arrays and nested feature objects, a shape people convert constantly.
Input
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": { "type": "Point", "coordinates": [-97.74, 30.27] },
"properties": { "name": "Austin" }
}
]
}An object with 3 nested shapes.
4 interfaces · 8 fields · 5 levels deep
TypeScript
export interface Root {
type: string;
features: Feature[];
}
export interface Feature {
type: string;
geometry: Geometry;
properties: Property;
}
export interface Geometry {
type: string;
coordinates: number[];
}
export interface Property {
name: string;
}Zod
import { z } from 'zod';
export const PropertySchema = z.object({
name: z.string(),
});
export const GeometrySchema = z.object({
type: z.string(),
coordinates: z.array(z.number()),
});
export const FeatureSchema = z.object({
type: z.string(),
geometry: GeometrySchema,
properties: PropertySchema,
});
export const RootSchema = z.object({
type: z.string(),
features: z.array(FeatureSchema),
});Convert your own JSON
Paste a sample on the home page, or call the API or MCP server. This page is also available as markdown.