OnlineMapMaker logo

JSON Map Viewer: Plot JSON Coordinates on a Map

Upload or paste ordinary JSON, for example an API response or an app export, and see every record with a latitude and longitude on a map. The viewer finds the list of records and the coordinate fields by itself, even inside nested objects, and lets you export the points as GeoJSON or CSV. Open fullscreen version →

Rate this tool:
Advertisement
Advertisement
Loading viewer…
Need assistance with your GIS project?Explore Our Services

What this viewer does

A lot of location data never arrives as a GIS file. It comes as plain JSON: the response of a weather API, a list of shops from a store locator, an export from a delivery app, or a file a developer sends you. Each record has a latitude and a longitude somewhere, but a map tool that expects GeoJSON cannot read it, and opening it in a spreadsheet loses the nested structure.

This viewer reads that JSON as it is. It looks through the whole document for lists of records, flattens nested objects into field names such as `location.lat`, and recognises the usual names for latitude and longitude, as well as single fields that hold both values, like `[lng, lat]` arrays or `"lat, lng"` strings. Every record that has valid coordinates appears on the map. The sidebar tells you how many records had no coordinates or values outside the valid range, and it warns you when latitude and longitude look swapped.

I built it for the moment when someone sends you a JSON file and asks "where are these?". You can check the data in seconds, color the points by any field, click a point to read the whole record, and download the result as GeoJSON for a GIS or as CSV for a spreadsheet. The file is read in your browser and is never uploaded.

Advertisement
Advertisement

JSON shapes the viewer understands

Real JSON comes in many shapes. These are the ones the viewer reads without any setup. In each case it shows the list of records it found, and you can pick another list if the file has several.

A plain array of objects
[{ "name": "Berlin", "lat": 52.52, "lng": 13.405 }]
The most common shape. The array itself is the list of records, and lat and lng are found by name.
Records nested inside an API response
{ "data": { "cities": [{ "name": "Paris", "latitude": 48.8566, "longitude": 2.3522 }] } }
The viewer searches the whole document and finds the list at data.cities. Other lists in the same file appear in the "List of records" menu.
Coordinates inside a nested object
[{ "name": "Rome", "location": { "lat": 41.9028, "lon": 12.4964 } }]
Nested objects are flattened, so the fields become location.lat and location.lon. A latitude and longitude with the same parent are preferred.
One array with both values
[{ "id": 7, "coordinates": [2.1686, 41.3874] }]
A field called coordinates is read as [longitude, latitude], the GeoJSON order. For other names, the order is decided from the value ranges.
One string with both values
[{ "stop": "Central", "latlng": "59.3293, 18.0686" }]
A string like "59.3293, 18.0686" is split into two numbers. Strings are read as latitude first, the order used by Google Maps and most apps.
An object of objects, keyed by ID
{ "BER": { "lat": 52.52, "lng": 13.405 }, "PAR": { "lat": 48.86, "lng": 2.35 } }
When every value of an object is a record, the object becomes the list. The key is kept in a _key field.
JSON Lines / NDJSON
{"lat": 38.72, "lng": -9.14}
{"lat": 41.16, "lng": -8.63}
If the file is not one JSON document, each line is read as its own record.

Numbers stored as text, such as "52.52", and numbers with a comma as the decimal sign, such as "52,52", are read too. Arrays inside a record, such as a list of tags, are kept as JSON text in the popup and in the export.

Which field names are recognised

The viewer matches the last part of each field name, so `lat`, `location.lat` and `data.geo.lat` all count. Matching ignores upper and lower case. If nothing matches, you pick the fields yourself in the Coordinates panel.

Latitude
lat, latitude, lat_dd, y, ycoord, point_y, decimalLatitude, gps_lat, geo_lat and similar forms.
Longitude
lng, lon, long, longitude, lon_dd, x, xcoord, point_x, decimalLongitude, gps_lon, geo_lng and similar forms.
One field with both
Names ending in coordinates, coords, position, latlng, lnglat, location, geo, point, center or gps, when the value is a two-number array or a "a, b" string.
Choosing between candidates
Every possible latitude/longitude pair is tested on the first 300 records. The pair with the most values inside ±90 and ±180 wins, a pair with the same parent object gets a bonus, and x/y lose ties against real lat/lng names.
Order of a pair
lnglat, lonlat and coordinates mean longitude first. latlng and latlon mean latitude first. For other names, the order with more values in range wins. When both orders fit, arrays are read as [lng, lat] and strings as "lat, lng".

Technical details

This is exactly what the viewer accepts and produces.

Input
.json, .jsonl and .ndjson files up to 50 MB, or JSON pasted into the Paste JSON box.
Not for GeoJSON or TopoJSON
If the file is already GeoJSON ("type": "FeatureCollection") or TopoJSON ("type": "Topology"), you get a message pointing to the GeoJSON Viewer or the TopoJSON Viewer on this site.
Record lists
Arrays where at least half the items are objects, at any depth up to 8 levels, plus objects whose values are all records. Lists that contain coordinates are listed first, then the larger ones.
Valid coordinates
Latitude between −90 and 90, longitude between −180 and 180, in decimal degrees (WGS84). Records outside these ranges are counted and left off the map.
Swap warning
If a record is out of range but would be valid with latitude and longitude swapped, the viewer counts it and offers a Swap button.
Color by field
Any field with up to 10 different values can color the points, with a legend and a count per value.
Performance
Points are drawn on a canvas, so tens of thousands of records stay smooth on a normal laptop.
Export
GeoJSON with every field as a property, or CSV with latitude and longitude as the first two columns and the flattened fields after them.
Privacy
The file is read in your browser. Only the basemap tiles come from the internet.

How to put JSON on a map, step by step

Here is the whole workflow with the built-in sample: 25 European cities inside a nested API-style response, with the coordinates in a `location` object and one record that has no location.

Empty JSON Map Viewer with the Upload, Paste JSON and Sample Data buttons above a world map
1
Step 1: Open the viewer

The map opens with a street basemap. Use Upload, Paste JSON, or drag a file onto the map. Here I clicked Sample Data.

24 city points on a map of Europe with the Records panel showing 24 on the map and 1 without coordinates
2
Step 2: Check what was found

The Records panel shows the list the viewer picked (`data.cities`), how many records are on the map, and how many had no coordinates. In the sample, one record has `"location": null`, so 24 of 25 are mapped.

Coordinates panel with Two fields selected and location.lat and location.lng chosen
3
Step 3: Confirm the coordinate fields

The Coordinates panel shows the detected fields, here `location.lat` and `location.lng`. Switch to "One field" for data with a single `[lng, lat]` or `"lat, lng"` field, and use Swap if the points land in the wrong place.

City points colored by the capital field, with a legend showing true and false
4
Step 4: Color the points by a field

Pick a field under "Color by field". Here `capital` splits the cities into capitals and other cities, with a legend and a count for each value.

Popup on Berlin showing its coordinates, id, name, country, capital, location fields and tags
5
Step 5: Read a record

Click any point to see its exact coordinates and every field of the record, including nested values and arrays.

Actions panel with the GeoJSON and CSV download buttons highlighted
6
Step 6: Export

Download the mapped points as GeoJSON for QGIS, ArcGIS or a web map, or as CSV for Excel and Google Sheets.

Advertisement
Advertisement

Other ways to map JSON data

This viewer is the fastest way to look at a JSON file. When you need the same job inside a workflow, these are the tools I use.

QGIS

QGIS cannot place plain JSON records on a map by itself. It reads GeoJSON, and it reads CSV through "Add Delimited Text Layer". The usual route is to convert the JSON to CSV or GeoJSON first, which is what the export buttons here do.

Python with pandas and GeoPandas

pandas.json_normalize flattens nested JSON into columns with dot names, just like this viewer. geopandas.points_from_xy then builds the points. Remember that it takes x (longitude) first.

jq on the command line

jq can reshape any JSON into a GeoJSON FeatureCollection in one command. It is ideal in scripts that pull data from an API on a schedule.

JavaScript and Leaflet

If you build your own web map, you can loop over the records and add markers. Leaflet expects [lat, lng], while GeoJSON stores [lng, lat]. Mixing them up is the most common bug in map code.

The same job in code

All three examples read the sample file used above, skip the record without a location, and keep the other fields.

# Python: pandas flattens nested JSON, GeoPandas builds the points
import json
import pandas as pd
import geopandas as gpd

with open("cities.json") as f:
    data = json.load(f)

df = pd.json_normalize(data["data"]["cities"])   # columns: location.lat, location.lng
df = df.dropna(subset=["location.lat", "location.lng"])
gdf = gpd.GeoDataFrame(
    df, geometry=gpd.points_from_xy(df["location.lng"], df["location.lat"]), crs="EPSG:4326"
)
gdf.to_file("cities.geojson", driver="GeoJSON")
# jq on the command line: JSON records to a GeoJSON FeatureCollection
jq '{type: "FeatureCollection", features: [
      .data.cities[] | select(.location != null) | {
        type: "Feature",
        properties: del(.location),
        geometry: { type: "Point", coordinates: [.location.lng, .location.lat] }
      }]}' cities.json > cities.geojson
// JavaScript + Leaflet: note the order, Leaflet wants [lat, lng]
const res = await fetch("cities.json");
const json = await res.json();
for (const c of json.data.cities) {
  if (!c.location) continue;
  L.marker([c.location.lat, c.location.lng]).bindPopup(c.name).addTo(map);
}

My take: use this viewer to understand a new JSON file and check its coordinates. Once you know the structure, a few lines of Python or jq turn it into GeoJSON every time the data changes.

How the viewer works

This is what happens between dropping a file and seeing the points. Every step runs in your browser.

  1. Parse the text. The text is parsed as JSON. If that fails and the file has several lines, each line is parsed as JSON Lines. A byte order mark at the start is removed.
  2. Reject files that have their own viewer. GeoJSON and TopoJSON are recognised by their type and sent to the matching viewer on this site, because they already contain real geometry.
  3. Find the lists of records. The viewer walks the document up to 8 levels deep and collects every array that is mostly objects, and every object whose values are all records. Each record is flattened into dot paths.
  4. Detect the coordinates. Field names are matched against the lists above. Every candidate pair is tested on up to 300 records, and the pair with the most valid values wins. If no pair fits, single fields with two numbers are tried.
  5. Build the points. Each record is read with the chosen fields. Text numbers are converted, values outside ±90 / ±180 are counted and skipped, and records that would fit when swapped are counted separately.
  6. Draw, color and export. The points are drawn on a canvas layer and the map zooms to them. Changing a field, the order or the color redraws the map at once. The exports use exactly the records you see.

Detection only makes a first guess. Every choice can be changed in the sidebar, and the map updates as soon as you change it, so a wrong guess costs one click.

Checking coordinates: ranges, swaps and precision

A latitude/longitude pair is just two numbers. These three checks tell you whether the numbers make sense.

1. Valid ranges

Latitude measures north and south from the equator, so it can only go from −90 at the South Pole to +90 at the North Pole. Longitude measures east and west from Greenwich and goes from −180 to +180.

valid  ⇔  −90 ≤ latitude ≤ 90   and   −180 ≤ longitude ≤ 180

latitude 91.2, longitude 10.5   →  invalid (latitude too large)

A value outside these ranges is almost always one of three things: the fields are swapped, the data is in a projected system such as UTM or Web Mercator metres, or the decimal point was lost (52520000 instead of 52.52).

2. Detecting swapped values

If a pair is invalid as it stands but valid when the two numbers change places, the fields are probably swapped. The viewer counts these records and offers a Swap button.

stored:   lat = 151.21,  lng = −33.87   →  invalid
swapped:  lat = −33.87,  lng = 151.21   →  valid (Sydney)

This test cannot catch every swap. When both numbers are between −90 and 90, both orders are valid. Paris stored as (2.35, 48.86) instead of (48.86, 2.35) lands in the Indian Ocean off the coast of Somalia. If your points appear in the wrong part of the world, try Swap and look at the map.

3. Decimal places and precision

One degree of latitude is about 111 km everywhere. One degree of longitude is about 111 km at the equator and shrinks with the cosine of the latitude. So each decimal place makes the position about ten times more precise.

1° latitude  ≈ 111 320 m
1° longitude ≈ 111 320 m · cos(latitude)

decimals   latitude step   longitude step in Berlin (52.52°)
1          11.1 km          6.8 km
2          1.1 km           680 m
3          111 m            68 m
4          11.1 m           6.8 m
5          1.1 m            0.68 m
6          0.11 m           0.07 m

Four decimals are enough to find a building, five to find a door, and six are already finer than a normal phone GPS. If your JSON has 10 or 15 decimals, the extra digits do not add accuracy; they come from floating-point arithmetic.

Advertisement
Advertisement

When this viewer helps

These are the situations where I reach for a JSON map viewer.

  1. Checking an API response. Paste the response of a weather, transport or store locator API and see at once whether the locations make sense, before you write any map code.
  2. Reviewing an app or database export. Delivery apps, CRMs and IoT platforms often export JSON. Map the export to find records with missing or wrong coordinates.
  3. Turning JSON into GeoJSON or CSV. Get a GeoJSON file for QGIS or ArcGIS, or a CSV for Excel, without writing a script.
  4. Finding swapped coordinates. The swap warning and the map make it easy to spot the classic bug where latitude and longitude change places somewhere in a pipeline.
  5. Exploring open data portals. Many open data portals offer JSON next to CSV. The JSON often keeps nested details that the CSV drops, and you can map it directly.
  6. Grouping points by a field. Color by status, category or type to see patterns, for example which stations are offline or which stores are open on Sundays.
  7. Debugging map code. If your own map shows points in the wrong place, load the same JSON here. If the points are right here, the bug is in your code, often a [lat, lng] versus [lng, lat] mix-up.
  8. Teaching JSON and coordinates. Students can paste small JSON examples and see how nesting, field names and coordinate order change the result on the map.

Frequently asked questions

1. How do I show JSON data on a map?

Upload the file, paste the JSON, or drag the file onto the map. The viewer finds the records and the latitude and longitude fields by itself. If it cannot find them, choose the fields in the Coordinates panel.

2. What is the difference between JSON and GeoJSON?

JSON is a general data format. GeoJSON is a JSON standard (RFC 7946) with a fixed structure for geometry: features with a geometry object and properties. Plain JSON can hold coordinates in any field with any name, which is why this viewer has to find them.

3. My coordinates are inside a nested object. Does that work?

Yes. Nested objects are flattened into dot paths, so {"location": {"lat": 52.5}} becomes the field location.lat. The viewer looks up to 8 levels deep.

4. My file has several lists. Which one is used?

The viewer prefers a list that has coordinates, then the largest one. All lists it found are in the "List of records" menu, so you can switch to another one.

5. My points are in the wrong place. What should I do?

Click Swap first. Latitude and longitude are often stored the other way round. If the points are still wrong, check the coordinate system: values in the thousands or millions are probably UTM or Web Mercator metres, not degrees.

6. Why are some records missing from the map?

The Records panel tells you why: either the record had no value in the coordinate fields, or the values were outside ±90 for latitude or ±180 for longitude. Only valid records are drawn and exported.

7. Does it work with coordinates stored as text?

Yes. "52.52" and "52,52" are both read as numbers. Strings with both values, such as "52.52, 13.405", also work when you pick "One field".

8. Which order does a [a, b] array use?

A field called coordinates uses the GeoJSON order, [longitude, latitude]. latlng means latitude first and lnglat longitude first. For other names, the viewer tests both orders and picks the one with more valid values. You can always change it in the Order menu.

9. Can I open GeoJSON or TopoJSON here?

No, and you do not need to. Those formats already contain geometry, so the viewer points you to the GeoJSON Viewer or the TopoJSON Viewer on this site.

10. How many records can it handle?

Files up to 50 MB. The points are drawn on a canvas, so tens of thousands of points stay smooth. Very large files take a few seconds to parse.

11. Is my data uploaded?

No. The file is read in your browser, and the exports are created in your browser too. Only the basemap tiles are loaded from the internet.

Libraries and credits

The JSON reading and coordinate detection were written for this site. The map is built on open source software.

Related tools

JSON files are read in your browser and never uploaded to a server. The sample coordinates are city centres with at most 4 decimals. Map tiles © OpenStreetMap contributors, drawn with Protomaps (hosted by KONAKTIVE), with CARTO as the fallback. Satellite imagery: Esri.

Muhammad Gulraiz Khan, GIS Expert and Founder of KONAKTIVE and OnlineMapMaker.com

About the Author

Muhammad Gulraiz Khan

GIS Expert & Consultant · Founder, KONAKTIVE

Muhammad Gulraiz Khan is a GIS expert with over a decade of professional experience delivering geospatial solutions for the energy sector, including projects for the World Bank, the International Finance Corporation (IFC), and USAID. He built OnlineMapMaker.com to make professional-grade mapping tools free and accessible to everyone.

Advertisement
Advertisement