write metadata as json