<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Issues implementing a JSON payload on Workato in Workato Pros Discussion Board</title>
    <link>https://systematic.workato.com/t5/workato-pros-discussion-board/issues-implementing-a-json-payload-on-workato/m-p/4988#M2224</link>
    <description>&lt;P&gt;There are different ways to handle this, but I think the simplest is to take the object into a Ruby or JS action and reformat it into something consistent and parsable.&lt;/P&gt;&lt;P&gt;Using your data above, this will work in a Ruby action:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;dest = input["destinations"]

keys = dest.keys
reformat = []

keys.each { | k | 
  obj = {}
  obj["key"] = k
  obj["value"] = dest[k]
  reformat.push(obj)
}

{reformat: reformat}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;[
  {"key":"0", "value":"dest1"},
  {"key":"1", "value":"dest2"}
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Aug 2023 16:07:52 GMT</pubDate>
    <dc:creator>gary1</dc:creator>
    <dc:date>2023-08-23T16:07:52Z</dc:date>
    <item>
      <title>Issues implementing a JSON payload on Workato</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/issues-implementing-a-json-payload-on-workato/m-p/4986#M2223</link>
      <description>&lt;P&gt;I have been creating an integration between salesforce and another system. The issue comes up when there are multiple Location Objects involved from Salesforce. How can we have dynamic Keys generated. See the snippet below to get a better idea:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "destinations":{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "0":"dest1",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "1":"dest2"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;How would we be dealing with the dynamic number of destinations with this payload design?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2023 12:21:34 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/issues-implementing-a-json-payload-on-workato/m-p/4986#M2223</guid>
      <dc:creator>gmaheshwari</dc:creator>
      <dc:date>2023-08-23T12:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Issues implementing a JSON payload on Workato</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/issues-implementing-a-json-payload-on-workato/m-p/4988#M2224</link>
      <description>&lt;P&gt;There are different ways to handle this, but I think the simplest is to take the object into a Ruby or JS action and reformat it into something consistent and parsable.&lt;/P&gt;&lt;P&gt;Using your data above, this will work in a Ruby action:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;dest = input["destinations"]

keys = dest.keys
reformat = []

keys.each { | k | 
  obj = {}
  obj["key"] = k
  obj["value"] = dest[k]
  reformat.push(obj)
}

{reformat: reformat}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;[
  {"key":"0", "value":"dest1"},
  {"key":"1", "value":"dest2"}
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2023 16:07:52 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/issues-implementing-a-json-payload-on-workato/m-p/4988#M2224</guid>
      <dc:creator>gary1</dc:creator>
      <dc:date>2023-08-23T16:07:52Z</dc:date>
    </item>
  </channel>
</rss>

