API insert Content block in page clears newlines

Permalink
Hi all,

A shout in the dark from here, as I think it's quite a niche problem...

I am exporting one website, page by page, and each page content goes in JSON. Then, I am importing the JSON contents in Concrete5.7.4.1 using API calls. Here's a fully functional, isolated portion of the importing script, that works very well if put in a single page:

1 <?php
  2 $json_in = '{"main":"some text line<br/>one more line<br/><pre>some text that\nis present on many\nlines</pre>"}';
  3 $json_ary = json_decode($json_in,1);
  4 
  5 $parentPage = \Page::getByPath('/tests');
  6 $pageType = \PageType::getByHandle('page');
  7 $pageTemplate = \PageTemplate::getByHandle('full');
  8 try {
  9     #add new page
 10     $pageData = array(
 11         'cName' => 'One test',
 12     );
 13     $newPage = $parentPage->add($pageType,$pageData,$pageTemplate);
 14     
 15     #add a content block to the new page


The problem I have is the content inside the <pre>...</pre> tags. Normally, this should be rendered on screen "as is", kind of like this (for the above code):
some text line
one more line
some text that
is present on many
lines


but what I get is this:
some text line
one more line
some text that is present on many lines


This is due to the fact that the "Content" block is prettifying its content at adding time (i.e. it removes all new lines), so, the <pre>...</pre> gets a one line string instead of a multiline as it is in original. (I have tested this in the GUI too by copy/pasting the <pre>...</pre> original content in the HTML view, and behaves the same: it's cutting the linebreaks)

An obvious alternative would be to use a HTML block instead of a Content one, which I tested both through API and GUI and respects the line breaking in the <pre>...</pre>. However this is a really big inconvenient due to the fact that, after import, the newly created pages/blocks need to be editable using WYSIWYG (Redactor) by non tech people; so no HTML direct fiddling.

So, my question for the API gods is: is there any option I could pass to the addBlock API call so to avoid prettifying the content?

Or even: should I dare to ask for such an option to the core?
(Another possible discussion is if this shouldn't be the default for API calls: imho, the content should be left in the block as it is, if it is coming through the API. Prettifying should be in API user's care, me in this case)

Thank you in advance for any opinions.

Lian