Am trying to enclose/add square brackets to Json after using XSLT for conversion. I want the Json to be in a list/array form.
Below is my XML file.
<?xml version="1.0" encoding="UTF-8"?>
<map xmlns="http://www.w3.org/2005/xpath-functions">
<string key="foedselsdato">2019-04-22</string>
<string key="individId">01387</string>
<map key="varslinger"/>
</map>
This is my XSL file below.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="3.0">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:value-of select="xml-to-json(., map { 'indent' : true() })"/>
</xsl:template>
</xsl:stylesheet>
Using https://xsltfiddle.liberty-development.net/b4GWVd for conversion i get :
{ "foedselsdato" : "2019-04-22",
"individId" : "01387",
"varslinger" :
{ } }
But I would like to convert it as below:
[{ "foedselsdato" : "2019-04-22",
"individId" : "01387",
"varslinger" :
{ } }]