How can I view the object in 2D in the front view
You must have been in the front perspective mode instead of front orthographic mode. You just have to press numpad '5' key to get to orthographic mode.

Front perspective looks like this and you can see that on the top left of the screen.


Front ortho looks like this. Again, its mentioned in the top left of the screen.


If you don't have a numpad in your keyboard.Press Ctrl+Alt+U for preferences and enable 'emulate numpad' in the 'Input' tab. And then, instead of numpad 5, you can just press the normal '5' to get to orthographic mode.