Fixed erroneous renderings of JSON

### Description
'statistics' json response fixed.
Fixes issue #428 and a little more.
Unit tests added for json part.

Fixed in e28b548