check if json is empty before saving