Hi Charlie !

So, I am doing that exact same thing.

I wrote

1) The specification to convert netCDF/HDF5 to "a" JSON format (note the "a" here)

2) I wrote the parsing of the JSON format using an open source C JSON library (janson).


3) left to do: the actual C code of reading/writing netCDF/HDF5 to JSON and vice-versa (the straightforward part).

The "a" above means that JSON is not really a format in the sense of netCDF but really a format that allows to define formats , for a lack of a better

This means that anyone that writes this tool has to write code that write in a particular JSON representation , only valid for that tool.

Like you , I searched and there was not a good one, so I wrote one.

The first criteria was that it had to be obvious for anyone looking at the JSON text file, that that was indeed a netCDF/HDF5 file: hierarchy clearly show, metadata and data
clearly shown

My first look  was HDF5-JSON


but the format seemed like a  mess to look at



and the reader is written in Python

@John Readey

(why Phyton? HDF5 developer tools should be all about writing in C/C++)

The specification is here


Click on menu
"Code blog",
"netCDF/HDF5 to JSON and vice-versa"

In the process I learned all about JSON and it is a neat format to represent data .

In particular, it allows nested structures and arrays, which suits perfectly for netCDF

here are two nested groups

 "group_name2": "group"

a dataset

"dset1" : ["dataset", "STAR_INT32", 2, [3, 4], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]

This is still under development,

I would like to make this some kind of "official" netCDF/HDF5 JSON format for the community, so I encourage anyone to read the specification

direct link


If you see any flaw in the design or antything in the design that you would like to have change please let me know now

At the moment it only (intentionally) uses common generic features of both netCDF and HDF5, which are the numeric atomic types and strings.


Pedro Vicente

----- Original Message ----- From: "Charlie Zender" <zen...@uci.edu>
To: "netCDF Mail List" <netcdfgr...@unidata.ucar.edu>
Sent: Thursday, October 13, 2016 11:10 PM
Subject: [netcdfgroup] How to dump netCDF to JSON?

Hello netCDFers,

A project I am working on wants to convert netCDF files to JSON.
The requirements are to dump an arbitrary netCDF-extended file
(with groups but without funky vlen/compound types) to JSON.
The first few solutions that we googled (ncdump-json, netcdf2json.py)
do not satisfy these requirements. What is the most robust and easy
command-line tool (not web-service) that dumps netCDF to JSON?
Ideally it would be somewhat configurable like ncdump -h/-x or
ncks --cdl/--xml.

Charlie Zender, Earth System Sci. & Computer Sci.
University of California, Irvine 949-891-2429 )'(

NOTE: All exchanges posted to Unidata maintained email lists are
recorded in the Unidata inquiry tracking system and made publicly
available through the web.  Users who post to any of the lists we
maintain are reminded to remove any personal information that they
do not want to be made public.

netcdfgroup mailing list
For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/

Hdf-forum is for HDF software users discussion.
Twitter: https://twitter.com/hdf5

Reply via email to