Using bramstein/xsltjson's xml-to-json.xsl. It handles arrays properly