testcases for write_json