json write for files