<?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: Merge JSON outputs &amp;gt; 500 objects? in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124723#M6061</link>
    <description>&lt;P&gt;Unfortunately, I'm not as familiar with PHP.&lt;BR /&gt;That said, there is a JQ module for PHP, maybe that will help here?&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jul 2021 22:36:44 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2021-07-22T22:36:44Z</dc:date>
    <item>
      <title>Merge JSON outputs &gt; 500 objects?</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124594#M6046</link>
      <description>&lt;P&gt;Hi guys, literally tearing my hair out here (don't have much to start off with). But working with PHP to pull data from the webapi using CURL. This all works great as long as there is under 500 objects, soon as I go over the 500 object mark I'm unable to merge the arrays successfully to output a unified data view.&lt;/P&gt;
&lt;P&gt;Any ideas on the best way to do this, I believe the issue is that we've got multi arrays { [objects] [to] [from] [total] } I tried deleting the to/from/total and merging but was unsuccessful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be much appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 19:24:18 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124594#M6046</guid>
      <dc:creator>DanielS</dc:creator>
      <dc:date>2021-07-21T19:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Merge JSON outputs &gt; 500 objects?</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124605#M6047</link>
      <description>&lt;P&gt;Curious why are you trying to create a single JSON output.&lt;BR /&gt;And how precisely is it failing when you try and do so.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 20:25:37 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124605#M6047</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-07-21T20:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Merge JSON outputs &gt; 500 objects?</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124613#M6049</link>
      <description>&lt;P&gt;Hi phoneboy I have a list of IP addresses that I need to compare the database against, this would be very easy in 1.8API with the filter command.&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit; background-color: #ffffff;"&gt;My thoughts were to save me constantly pulling the objects, too store them in 1 big json array for processing, this is just one example and may need to be done on regular occasions hence building a tool for it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit; background-color: #ffffff;"&gt;I can that the second load of objects are being successfully pulled from the mds via a var_dump of the functions return, but array_merge just isn't working. I've tried json_decode before merge them json_encode after and the other way around but it's not wanting to go in and array size stays at 500, or it wipes out the array completely (that could have been a typo) as I was trying lots of things.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 22:07:30 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124613#M6049</guid>
      <dc:creator>DanielS</dc:creator>
      <dc:date>2021-07-21T22:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Merge JSON outputs &gt; 500 objects?</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124616#M6050</link>
      <description>&lt;P&gt;Actually, that's a very good reason for creating a merged JSON file &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;I believe you can use jq to do this like so:&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;jq -s '.[0] * .[1]' 1.json 2.json&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 22:22:07 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124616#M6050</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-07-21T22:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Merge JSON outputs &gt; 500 objects?</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124652#M6053</link>
      <description>&lt;P&gt;anyway you can think of how to do this in PHP? This is my current loop, excuse the messiness of the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;do
{
		if(!isset($mergedArrays))
		{
			$mergedArrays = array();
			$mergedArrays = json_decode(runAPI_Command($ip,$domainsid,$domain,$actions,$currentPosition),true);
			$totalObjects = $mergedArrays["total"];
						$currentPosition = $mergedArrays["to"];
		}
		else
		{
			$output = json_decode(runAPI_Command($ip,$domainsid,$domain,$actions,$currentPosition),true);
			$currentPosition = $output["to"];
					$mergedArrays = array_merge($output["objects"],$output["to"],$output["from"],$output["total"]);
		}
			$currentPosition = $mergedArrays["to"];
			$size = sizeof($mergedArrays["objects"]);
			echo "&amp;lt;br&amp;gt;Total Objects:$totalObjects &amp;lt;br&amp;gt;";
			echo "Current Position:$currentPosition&amp;lt;br&amp;gt;";
			echo "Size of Array:$size";			 
} while ($currentPosition &amp;lt; $totalObjects);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 08:52:42 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124652#M6053</guid>
      <dc:creator>DanielS</dc:creator>
      <dc:date>2021-07-22T08:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Merge JSON outputs &gt; 500 objects?</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124723#M6061</link>
      <description>&lt;P&gt;Unfortunately, I'm not as familiar with PHP.&lt;BR /&gt;That said, there is a JQ module for PHP, maybe that will help here?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 22:36:44 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Merge-JSON-outputs-gt-500-objects/m-p/124723#M6061</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-07-22T22:36:44Z</dc:date>
    </item>
  </channel>
</rss>

