1. It was important to me to be financially independent of my parents.

2. It was important for me to be financially independent of my parents.

(Which one is correct? Do we have to use 'for' or 'to'?)

Both are correct.

Both sentences are grammatically correct, but they convey slightly different meanings.

1. "It was important to me to be financially independent of my parents."
In this sentence, the phrase "to me" expresses that the importance is specific to the speaker's personal perspective. The focus is on the speaker's own desire for financial independence.

2. "It was important for me to be financially independent of my parents."
In this sentence, the preposition "for" introduces the reason or purpose behind the importance. It suggests that being financially independent from parents is considered significant and necessary for the speaker's overall well-being or personal growth.

Ultimately, the choice between using "to" or "for" depends on the specific meaning or emphasis you want to convey. Both options are grammatically acceptable, and you can select the one that best suits your intended message.