I was amazed at how clever the boy was.

Literal

I [topic-は] that boy [of-の] clever [nominalizer-の-に] was-surprised.

The の after 利発な is a nominalizer turning the adjective phrase into a noun-like clause — 'the boy's being clever.' The に then marks what the speaker was surprised at (驚く takes に for its target). This is a neat example of clause nominalization with の — a pattern that lets you plug adjective phrases into slots that require nouns.