basic functions for reading and writing json