# Output multiple elements as a JSON array in XSLT

I have an XSL Code as shown below.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes" />

</xsl:variable>

<xsl:variable xmlns:exsl="http://exslt.org/common" name="data" select="exsl:node-set($inlineAddreddArray)" /> <addressLines> <xsl:value-of select="$data/addrline" />

</xsl:stylesheet>


My expected JSON output should be:

"addressLines":"[Home1,Home2,Home3]"


Output that I’m getting

"addressLines": "Home1Home2Home3"


Basically it is just concatenating every element as a single element.

But, I should get three elements separately as shown above.

Can anyone please help me on this? Don’t mind if it’s a silly query. I’m very new to XSLT 🙂