〜の・〜こと (which one?)
turning a verb into a noun: when it must be の, and when こと
Plain form + の (見る · 聞こえる · 手伝う · 待つ) · Plain form + こと (です · ができる · にする)
Sign up free to review this point on a spaced schedule.
Both の and こと turn a verb into a noun, and often either works: 泳ぐのが好き, 泳ぐことが好き. But some patterns accept only one.
Only の: with verbs of seeing, hearing and joining in, like 見る, 聞こえる, 手伝う, 待つ, 止める: 子どもが遊んでいるのを見た, "I watched the children playing". Also in のは〜だ (N4).
Only こと: directly before です or だ (私の夢は医者になることです), and in set patterns: ことができる, ことがある, ことにする, ことになる.
A quick check: if you're perceiving or taking part in the action itself, use の. If you're talking about it as an idea, a fact or a rule, use こと.
Examples
子どもたちが公園で遊んでいるのを見た。
I watched the children playing in the park.
私の夢は医者になることです。
My dream is to become a doctor.
隣の人が歌っているのが聞こえる。
I can hear the person next door singing.
母が料理を作るのを手伝った。
I helped my mother cook.
日本語を話すことができます。
I can speak Japanese.
駅で友達が来るのを待っています。
I'm waiting at the station for my friend to arrive.