Fixing bug. Method write_json() writes JSON in one line