#!/usr/bin/env python # coding: utf-8 # # Save Photon-HDF5 description to JSON # In[ ]: from collections import OrderedDict import json import phconvert as phc phc.__version__ # In[ ]: filename = 'phconvert/specs/photon-hdf5_fields.json' # Save: # In[ ]: with open(filename, 'wt') as f: json.dump(phc.hdf5.official_fields_descr, f, indent=4, separators=(',', ':\n ')) # Load: # In[ ]: with open(filename) as f: official_fields_descr = json.load(f, object_pairs_hook=OrderedDict) # Check roundtrip: # In[ ]: official_fields_descr == phc.hdf5.official_fields_descr # In[ ]: