added json reading/writing functions