move the output2json function to base class