Refacor CLI code and remove root element from the constructed json