<?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 Handling Arbitrary Object Names in JSON response in Workato Pros Discussion Board</title>
    <link>https://systematic.workato.com/t5/workato-pros-discussion-board/handling-arbitrary-object-names-in-json-response/m-p/849#M422</link>
    <description>&lt;P&gt;Hi All - has anyone found a way to handle arbitrary object names in JSON responses? (see format 1 below)&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I'm working with a custom app internally that breaks out transaction amounts by period for a given transaction. Each period is returned as a JSON object with periods as keys (format YYYYMM), which can be arbitrary depending on what periods the transaction contains. &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;STRONG&gt;Format 1: JSON object with arbitrary object names. As far as I know this won't work with Workato unless each unique period is defined in the JSON response schema:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;  "summary": {&lt;/P&gt;&lt;P&gt;    "&lt;STRONG&gt;202011&lt;/STRONG&gt;": {&lt;/P&gt;&lt;P&gt;      "period": "202011",&lt;/P&gt;&lt;P&gt;      "finance_total": 0,&lt;/P&gt;&lt;P&gt;      "order_payments_total": 458,&lt;/P&gt;&lt;P&gt;      "seller_fees_total": -45.8,&lt;/P&gt;&lt;P&gt;      "seller_fee_discounts_total": 0,&lt;/P&gt;&lt;P&gt;      "total": 412.2,&lt;/P&gt;&lt;P&gt;      "count": 2&lt;/P&gt;&lt;P&gt;    }&lt;/P&gt;&lt;P&gt;  },&lt;/P&gt;&lt;P&gt;  "meta": {&lt;/P&gt;&lt;P&gt;    "status": 200&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;STRONG&gt;Format 2: changing format 1 to a format that I know is compatible with Workato (JSON array w/o named keys).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;  "meta": {&lt;/P&gt;&lt;P&gt;    "status": 200&lt;/P&gt;&lt;P&gt;  },&lt;/P&gt;&lt;P&gt;  "category_by_period": [&lt;/P&gt;&lt;P&gt;    {&lt;/P&gt;&lt;P&gt;      "period": "202011",&lt;/P&gt;&lt;P&gt;      "finance_total": 0,&lt;/P&gt;&lt;P&gt;      "order_payments_total": 458,&lt;/P&gt;&lt;P&gt;      "seller_fees_total": -45.8,&lt;/P&gt;&lt;P&gt;      "seller_fee_discounts_total": 0,&lt;/P&gt;&lt;P&gt;      "total": 412.2,&lt;/P&gt;&lt;P&gt;      "count": 2&lt;/P&gt;&lt;P&gt;    }&lt;/P&gt;&lt;P&gt;  ]&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Thu, 29 Apr 2021 02:49:22 GMT</pubDate>
    <dc:creator>jblanchett</dc:creator>
    <dc:date>2021-04-29T02:49:22Z</dc:date>
    <item>
      <title>Handling Arbitrary Object Names in JSON response</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/handling-arbitrary-object-names-in-json-response/m-p/849#M422</link>
      <description>&lt;P&gt;Hi All - has anyone found a way to handle arbitrary object names in JSON responses? (see format 1 below)&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I'm working with a custom app internally that breaks out transaction amounts by period for a given transaction. Each period is returned as a JSON object with periods as keys (format YYYYMM), which can be arbitrary depending on what periods the transaction contains. &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;STRONG&gt;Format 1: JSON object with arbitrary object names. As far as I know this won't work with Workato unless each unique period is defined in the JSON response schema:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;  "summary": {&lt;/P&gt;&lt;P&gt;    "&lt;STRONG&gt;202011&lt;/STRONG&gt;": {&lt;/P&gt;&lt;P&gt;      "period": "202011",&lt;/P&gt;&lt;P&gt;      "finance_total": 0,&lt;/P&gt;&lt;P&gt;      "order_payments_total": 458,&lt;/P&gt;&lt;P&gt;      "seller_fees_total": -45.8,&lt;/P&gt;&lt;P&gt;      "seller_fee_discounts_total": 0,&lt;/P&gt;&lt;P&gt;      "total": 412.2,&lt;/P&gt;&lt;P&gt;      "count": 2&lt;/P&gt;&lt;P&gt;    }&lt;/P&gt;&lt;P&gt;  },&lt;/P&gt;&lt;P&gt;  "meta": {&lt;/P&gt;&lt;P&gt;    "status": 200&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;STRONG&gt;Format 2: changing format 1 to a format that I know is compatible with Workato (JSON array w/o named keys).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;  "meta": {&lt;/P&gt;&lt;P&gt;    "status": 200&lt;/P&gt;&lt;P&gt;  },&lt;/P&gt;&lt;P&gt;  "category_by_period": [&lt;/P&gt;&lt;P&gt;    {&lt;/P&gt;&lt;P&gt;      "period": "202011",&lt;/P&gt;&lt;P&gt;      "finance_total": 0,&lt;/P&gt;&lt;P&gt;      "order_payments_total": 458,&lt;/P&gt;&lt;P&gt;      "seller_fees_total": -45.8,&lt;/P&gt;&lt;P&gt;      "seller_fee_discounts_total": 0,&lt;/P&gt;&lt;P&gt;      "total": 412.2,&lt;/P&gt;&lt;P&gt;      "count": 2&lt;/P&gt;&lt;P&gt;    }&lt;/P&gt;&lt;P&gt;  ]&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 02:49:22 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/handling-arbitrary-object-names-in-json-response/m-p/849#M422</guid>
      <dc:creator>jblanchett</dc:creator>
      <dc:date>2021-04-29T02:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Arbitrary Object Names in JSON response</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/handling-arbitrary-object-names-in-json-response/m-p/850#M423</link>
      <description>&lt;P&gt;I have used the Ruby connector in the past to transform JSON objects into something that works better with Workato, so you could write a snippet that would take the objects in format 1 and turn the arbitrarily named objects into an array - you wouldn't lose data here as long as the name of the object matches what's in the period value. You could also just use the Ruby connector to turn format 1 into format 2 and that saves you redesigning your custom app. I can send you an example snippet if you like.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I've also had success in the past with just accessing JSON values directly in formula mode - so even if you don't have a datapill for the finance_total in format 1, you should still be able to access it by using &amp;lt;summary datapill&amp;gt;['202011']['finance_total'] in formula mode.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 04:16:47 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/handling-arbitrary-object-names-in-json-response/m-p/850#M423</guid>
      <dc:creator>asiya</dc:creator>
      <dc:date>2021-04-29T04:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Arbitrary Object Names in JSON response</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/handling-arbitrary-object-names-in-json-response/m-p/851#M424</link>
      <description>&lt;P&gt;What Asiya said &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 04:54:21 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/handling-arbitrary-object-names-in-json-response/m-p/851#M424</guid>
      <dc:creator>jeff-sutton</dc:creator>
      <dc:date>2021-04-29T04:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Arbitrary Object Names in JSON response</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/handling-arbitrary-object-names-in-json-response/m-p/852#M425</link>
      <description>&lt;P&gt;I have experience with a similar approach to what &lt;A href="https://systematic.workato.com/workato-migration/users/2373414"&gt;Asiya Kadri&lt;/A&gt; is suggesting. &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;In my case, I used a Ruby step to only extract the keys and put them into a list. Then I used this list in a '.pluck' formula to get the data/value from the original object. I guess the approach will depend of the level and complexity of the JSON.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 07:29:46 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/handling-arbitrary-object-names-in-json-response/m-p/852#M425</guid>
      <dc:creator>mroldanvega</dc:creator>
      <dc:date>2021-04-29T07:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Arbitrary Object Names in JSON response</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/handling-arbitrary-object-names-in-json-response/m-p/853#M426</link>
      <description>&lt;P&gt;This is great, thanks everyone! @asiya&lt;/P&gt;&lt;P&gt;if you have a ruby snippet you could share would be great.&lt;/P&gt;</description>
      <pubDate>Sat, 01 May 2021 02:16:48 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/handling-arbitrary-object-names-in-json-response/m-p/853#M426</guid>
      <dc:creator>jblanchett</dc:creator>
      <dc:date>2021-05-01T02:16:48Z</dc:date>
    </item>
  </channel>
</rss>

