<?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: Failed to convert to json in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Failed-to-convert-to-json/m-p/2297290#M81399</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure why you have the square brackets in there.&lt;BR /&gt;This works&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="color: #777777;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #7a3e9d;"&gt;contentneedtojson&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #4b69c6;"&gt;@&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;{&lt;/SPAN&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;name&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;Vin Test package&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;description&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;Vineeth Test package for export&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;contents&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;bc3f4cbc-a697-4da4-b275-2161bc0d561f&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #777777;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #777777;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #7a3e9d;"&gt;contentjson&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;=$&lt;/SPAN&gt;&lt;SPAN style="color: #7a3e9d;"&gt;contentneedtojson&lt;/SPAN&gt; &lt;SPAN style="color: #777777;"&gt;|&lt;/SPAN&gt;&lt;SPAN style="color: #aa3731; font-weight: bold;"&gt;ConvertTo-Json&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #777777;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #7a3e9d;"&gt;contentjson&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Sep 2020 08:58:48 GMT</pubDate>
    <dc:creator>LucD</dc:creator>
    <dc:date>2020-09-08T08:58:48Z</dc:date>
    <item>
      <title>Failed to convert to json</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Failed-to-convert-to-json/m-p/2297289#M81398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Requesting someone to help on this,&amp;nbsp; This is not&amp;nbsp; PowerCLI specific, but I'm using PowerShell to interact vRA using restapi to create a blueprint(Reference blog#&lt;A href="https://www.jonathanmedd.net/2016/01/create-blueprints-in-vra-7-via-rest-and-via-vro.html" title="https://www.jonathanmedd.net/2016/01/create-blueprints-in-vra-7-via-rest-and-via-vro.html"&gt;https://www.jonathanmedd.net/2016/01/create-blueprints-in-vra-7-via-rest-and-via-vro.html&lt;/A&gt; ). Below contents need to be converted to JSON but its showing error&lt;/P&gt;&lt;P&gt;Missing type name after '['.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="color: #9cdcfe;"&gt;$contentneedtojson&lt;/SPAN&gt;=&lt;SPAN style="color: #569cd6;"&gt;@&lt;/SPAN&gt;{&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ce9178;"&gt;"name"&lt;/SPAN&gt;=&lt;SPAN style="color: #ce9178;"&gt;"Vin Test package"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ce9178;"&gt;"description"&lt;/SPAN&gt;=&lt;SPAN style="color: #ce9178;"&gt;"Vineeth Test package for export"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ce9178;"&gt;"contents"&lt;/SPAN&gt;=[&lt;SPAN style="color: #ce9178;"&gt;"bc3f4cbc-a697-4da4-b275-2161bc0d561f"&lt;/SPAN&gt;]&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #9cdcfe;"&gt;$contentjson&lt;/SPAN&gt;=&lt;SPAN style="color: #9cdcfe;"&gt;$contentneedtojson&lt;/SPAN&gt; |&lt;SPAN style="color: #dcdcaa;"&gt;ConvertTo-Json&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #9cdcfe;"&gt;$contentjson&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/22817i356CDE8B562A2B46/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2020 07:48:48 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Failed-to-convert-to-json/m-p/2297289#M81398</guid>
      <dc:creator>vin01</dc:creator>
      <dc:date>2020-09-08T07:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Failed to convert to json</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Failed-to-convert-to-json/m-p/2297290#M81399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure why you have the square brackets in there.&lt;BR /&gt;This works&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="color: #777777;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #7a3e9d;"&gt;contentneedtojson&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #4b69c6;"&gt;@&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;{&lt;/SPAN&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;name&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;Vin Test package&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;description&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;Vineeth Test package for export&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;contents&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #448c27;"&gt;bc3f4cbc-a697-4da4-b275-2161bc0d561f&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #777777;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #777777;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #7a3e9d;"&gt;contentjson&lt;/SPAN&gt;&lt;SPAN style="color: #777777;"&gt;=$&lt;/SPAN&gt;&lt;SPAN style="color: #7a3e9d;"&gt;contentneedtojson&lt;/SPAN&gt; &lt;SPAN style="color: #777777;"&gt;|&lt;/SPAN&gt;&lt;SPAN style="color: #aa3731; font-weight: bold;"&gt;ConvertTo-Json&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #777777;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #7a3e9d;"&gt;contentjson&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2020 08:58:48 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Failed-to-convert-to-json/m-p/2297290#M81399</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2020-09-08T08:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Failed to convert to json</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Failed-to-convert-to-json/m-p/2297291#M81400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have tried that but showing below error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/22818i0D758B3191B0CA87/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2020 10:19:11 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Failed-to-convert-to-json/m-p/2297291#M81400</guid>
      <dc:creator>vin01</dc:creator>
      <dc:date>2020-09-08T10:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Failed to convert to json</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Failed-to-convert-to-json/m-p/2297292#M81401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is another error, nothing to do with the original ConvertTo-Json error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where is that API documented?&lt;BR /&gt;What is expected in the Body?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2020 10:33:49 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Failed-to-convert-to-json/m-p/2297292#M81401</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2020-09-08T10:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Failed to convert to json</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Failed-to-convert-to-json/m-p/2297293#M81402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am following this blog (&lt;A href="https://www.jonathanmedd.net/2016/01/create-blueprints-in-vra-7-via-rest-and-via-vro.html" title="https://www.jonathanmedd.net/2016/01/create-blueprints-in-vra-7-via-rest-and-via-vro.html"&gt;https://www.jonathanmedd.net/2016/01/create-blueprints-in-vra-7-via-rest-and-via-vro.html&lt;/A&gt; &amp;amp; &lt;A href="https://docs.vmware.com/en/vRealize-Automation/7.0/vrealize-automation-70-programming-guide.pdf" title="https://docs.vmware.com/en/vRealize-Automation/7.0/vrealize-automation-70-programming-guide.pdf"&gt;https://docs.vmware.com/en/vRealize-Automation/7.0/vrealize-automation-70-programming-guide.pdf&lt;/A&gt; ) to create blueprint in vRA. Here author used Postman REST client and I am using the same api with powershell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After replacing like below I got response success and package got created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15995622193422816 jive_text_macro" data-renderedposition="112_8_1232_96" jivemacro_uid="_15995622193422816"&gt;&lt;P&gt;$contentneedtojson=@{&lt;/P&gt;&lt;P&gt;"name"="Vin Test packages"&lt;/P&gt;&lt;P&gt;"description"="Vineeth Test package for export"&lt;/P&gt;&lt;P&gt;"contents"=[System.Object[]]"bc3f4cbc-a697-4da4-b275-2161bc0d561f"&lt;/P&gt;&lt;P&gt;} &lt;/P&gt;&lt;P&gt;$contentjson=$contentneedtojson |ConvertTo-Json&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expected package is created in vRA as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : Package&lt;/P&gt;&lt;P&gt;id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : c85234d0-5a5a-44aa-94c2-674920ab14d1&lt;/P&gt;&lt;P&gt;name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : Vin Test package&lt;/P&gt;&lt;P&gt;description : Vineeth Test package for export&lt;/P&gt;&lt;P&gt;tenantId&amp;nbsp;&amp;nbsp;&amp;nbsp; : SEZ18&lt;/P&gt;&lt;P&gt;subtenantId :&lt;/P&gt;&lt;P&gt;contents&amp;nbsp;&amp;nbsp;&amp;nbsp; : {bc3f4cbc-a697-4da4-b275-2161bc0d561f}&lt;/P&gt;&lt;P&gt;createdDate : 9/8/2020 8:18:35 AM&lt;/P&gt;&lt;P&gt;lastUpdated : 9/8/2020 8:18:35 AM&lt;/P&gt;&lt;P&gt;version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2020 10:50:58 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Failed-to-convert-to-json/m-p/2297293#M81402</guid>
      <dc:creator>vin01</dc:creator>
      <dc:date>2020-09-08T10:50:58Z</dc:date>
    </item>
  </channel>
</rss>

