Handle pretty=false and missing line feed for pretty=true which is the d...

...efault for main REST action.

Following the debate on #4182 this PR keeps the fact that the main REST action is prettyfied by default but handling the pretty=false parameter and the added line feed in the prettification process.