Complete the ability to print output as json for the EndoFluent.scala test and minor refactoring