fixed json write to better form