When building a personal flashcard the statement 'I ate pineapple' was translated as 'me comí la piña'. I thought it would be 'comí la piña'. SpanishDict's 3 translation tool websites voted once for the former and twice for the latter. What's correct, or are they both correct? If the former is correct, what is the reason for 'me' (is it a direct object? indirect object?)
What is spanish translation for 'I ate pineapple'?
Both are correct. How you use it exactly depends a bit on context.
"I ate pineapple" (unspecified quantities) - "Comí piña"
"I ate the pineapple" - "Me comí la piña" (I did it. I ate that particular pineapple).
"What did you have for lunch? I ate steak, the roasted vegetables and the pineapple" - "¿Qué almorzaste?" Comí bistec, los vegetales asados y la piña"
So, if it's "I ate the pineapple", then "me comí la piña" sounds much more natural to me. But if you want "I ate pineapple", then "Comí piña" (without "la") works fine.
I think it's simply, 'comí la piña'.