NC JSON
File conversion

Convert NC to JSON

QUICK ANSWER
Is it possible to convert NC to JSON?
Yes - NC converts to JSON.

Select the variable and dimension slice you need first, then serialize it with xarray's .to_dict() or .to_dataframe().reset_index().to_json(). Converting a full-resolution global dataset to JSON is impractical due to file size.

Also to JSON: BDOB · EXPRESS · REPLIT

On this page

Tested on macOS, Windows & Linux
Last verified Oct 2026

More free converters

HEIC, PNG, WEBP, MP3 and more - every tool here is free.

Open the toolbox

Why convert NC to JSON?

JSON is the native data exchange format for web applications and REST APIs. Exporting a subset of climate or oceanographic data from a netCDF file as JSON lets web visualizations and services consume it without a netCDF library. It is also human-readable, making it useful for inspecting metadata or a small variable slice during development.

How to convert NC to JSON

Python (xarray + netCDF4) FREE

Install with pip install xarray netCDF4, open the file with xarray.open_dataset(), select the variable and slice with .sel(), then call .to_dict() and json.dump() to write the output.

ncdump FREE

Run ncdump -h data.nc to inspect metadata or ncdump -v variable_name data.nc to dump a variable in CDL text format; pipe through a Python one-liner to produce JSON output.

About these formats

Quality & what to watch

  • JSON is practical only for small slices - a single global gridded variable at daily resolution can contain millions of numeric values, making the output slow to produce and difficult to consume.
  • Always identify variable names first by running ncdump -h yourfile.nc or print(ds) in xarray before attempting any export.
  • For a flat, records-oriented structure suitable for REST APIs, use subset.to_dataframe().reset_index().to_json(orient='records') instead of .to_dict().

Frequently asked questions

Can I convert the entire NC file to a single JSON document?
Technically yes, but it is rarely useful - the output is deeply nested and can be hundreds of megabytes for typical climate files. Always select a variable and slice first.
Is there an online tool to convert NC to JSON?
No reliable online converter exists; netCDF files are large scientific datasets that require library support beyond what browser-based tools can provide.
What JSON structure does xarray produce?
xarray's .to_dict() outputs a nested object with keys for coords, data_vars, dims, and attrs, mirroring the xarray Dataset structure.