Page 1 of 1

RESTOutput JSON Array

Posted: May 9th, 2024, 1:18 pm
by maschuster
When outputting a JSON array the first element is always

Code: Select all

   "Result": [
      {
        "@SelectOutput": "False"
      },
Can this be suppressed from the output?

Code: Select all

<RESTOutput>
	<Output>
		<Output>
			<Status>Good</Status>
			<Total>
				<xsl:value-of select="WorkData/GetUsers/Info/Result/NoOfRecords"/>
			</Total>
			<xsl:copy-of select="WorkData/GetUserDetails/Output/Result"/>
		</Output>
	</Output>
</RESTOutput>

Code: Select all

{
  "Output": {
    "Status": "Good",
    "Total": "23618",
    "Result": [
      {
        "@SelectOutput": "False"
      },

Re: RESTOutput JSON Array

Posted: May 10th, 2024, 3:11 pm
by SteveCap
To remove the @SelectOutput from the output you can change you RESTOutput service to be:

Code: Select all

<RESTOutput>
	<Output>
		<Output>
			<Status>Good</Status>
			<Total>
				<xsl:value-of select="WorkData/GetUsers/Info/Result/NoOfRecords"/>
			</Total>
			<xsl:for-each select="WorkData/GetUserDetails/Output/Result">
				<Result>
					<xsl:copy-of select="*"/>
				</Result>
			</xsl:for-each>
		</Output>
	</Output>
</RESTOutput>

Re: RESTOutput JSON Array

Posted: May 14th, 2024, 10:32 am
by maschuster
Thank you!