Added support for outputting structure json instead of text.