fix json debug for php < 5.4

Function pretty_print added in order to display correctly the json debug form in package interface.

fixes #2049
fix spaces removed in json when saving json debug

The regex replaced every spaces from the json to update.

fixes #2050