RESTOutput JSON Array

This forum allows users to post and respond to "How Do I Do ....." questions. The information contained in this forum has not been validated by K-Rise Systems and, as such, K-Rise Systems cannot guarantee the accuracy of the information.
Post Reply
maschuster
Posts: 2
Joined: May 26th, 2023, 8:11 am
Contact:

RESTOutput JSON Array

Unread post 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"
      },
word count: 65
SteveCap
Posts: 328
Joined: August 26th, 2021, 9:18 am
Contact:

Re: RESTOutput JSON Array

Unread post 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>
word count: 55
maschuster
Posts: 2
Joined: May 26th, 2023, 8:11 am
Contact:

Re: RESTOutput JSON Array

Unread post by maschuster »

Thank you!
word count: 2
Post Reply