write metadata as json to be able to search for fields