VE-526 / VE-1458 Format API response for better use in VisualEditor, and improve helper class