This question already has an answer here:
- を vs が with use against 好き? 3 answers
When I saw this sentence alone Mari wa neru koto ga suki desu I first thought neru koto is the direct object of the answer and should have an "o" particle, and not a "ga". Later I thought I might dont understand very well and may be actions can't be direct object or something, but after seeing the structure of the question that originates that answer more confusion arises:
Nani o suru koto ga suki desu ka?
Here Nani is marked as "o" (direct object) and in the answer that "what" becomes "suru koto" (which is marked as "ga" so supposedly it isnt a direct object) . isnt this contradictory? is it simply this way a valid syntactic rule or am I missunderstanding something more?