json string an obj and write into a file.