<?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: Contacts Build Import - multipart - Unable to process JSON error in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Contacts-Build-Import-multipart-Unable-to-process-JSON-error/m-p/885931#M69360</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello team, I would greatly appreciate any suggestions or recommendations you may have on this matter. Thank you in advance for your assistance.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Nov 2023 18:04:35 GMT</pubDate>
    <dc:creator>IVallejo</dc:creator>
    <dc:date>2023-11-28T18:04:35Z</dc:date>
    <item>
      <title>Contacts Build Import - multipart - Unable to process JSON error</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Contacts-Build-Import-multipart-Unable-to-process-JSON-error/m-p/885101#M69317</link>
      <description>&lt;P&gt;Hello -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have search this community as well as posted on Slack regarding this issue.&amp;nbsp; I update thousands of contacts daily and need to send them in bulk as processing them one at a time takes too long.&amp;nbsp; I have followed the documentation and suggestions made by others without success.&amp;nbsp; I am hopeing someone here can point out the obvious mistake and get me on my way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote a simple PowerShell script to send the bulk file.&amp;nbsp; HubSpot receives the request and returns an error 'Uable to process JSON'.&amp;nbsp; Here is my code, file, and HubSpot API messages.&amp;nbsp; In the below code, I generated the JSON by first creating an array and then converting to JSON.&amp;nbsp; I have also written the variable as text and convert to JSON - failed with the same error.&amp;nbsp; I have written the variable as JSON directly - failed with the same error.&amp;nbsp; As you can see, the request body in the HubSpot API log looks correct.&amp;nbsp; HubSpot appears to be receiving the correct information. Why is this error occurring and not processing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have spent hours on this and would greatly appreciate any help.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Bryan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PowerShell Code:&lt;/P&gt;&lt;P&gt;$dt3 = Get-Date -format yyyyMMdd&lt;/P&gt;&lt;P&gt;$fileNameExist = 'Batch_'+$dt3+'_N.csv'&lt;BR /&gt;$fileNameExist2 = 'Batch_'+$dt3+'_N'&lt;/P&gt;&lt;P&gt;$formatRequestExist8 = @{&lt;BR /&gt;'name' = "$fileNameExist2"&lt;BR /&gt;'files' = (&lt;BR /&gt;@{&lt;BR /&gt;'fileName' = "$fileNameExist"&lt;BR /&gt;'fileFormat' = "CSV"&lt;BR /&gt;'dateFormat' = "YEAR_MONTH_DAY"&lt;BR /&gt;'fileImportPage' = @{&lt;BR /&gt;'hasHeader' = $true&lt;BR /&gt;'columnMappings' = (&lt;BR /&gt;@{&lt;BR /&gt;'columnObjectTypeId' = "0-1"&lt;BR /&gt;'columnName' = "firstName"&lt;BR /&gt;'propertyName' = "firstname"&lt;BR /&gt;'idColumnType' = $null&lt;BR /&gt;},&lt;BR /&gt;@{&lt;BR /&gt;'columnObjectTypeId' = "0-1"&lt;BR /&gt;'columnName' = "lastName"&lt;BR /&gt;'propertyName' = "lastname"&lt;BR /&gt;'idColumnType' = $null&lt;BR /&gt;},&lt;BR /&gt;@{&lt;BR /&gt;'columnObjectTypeId' = "0-1"&lt;BR /&gt;'columnName' = "email"&lt;BR /&gt;'propertyName' = "email"&lt;BR /&gt;'idColumnType' = $null&lt;BR /&gt;}&lt;BR /&gt;)&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;)&lt;BR /&gt;} | ConvertTo-Json -depth 10&lt;/P&gt;&lt;P&gt;$formatRequestExist88 = $formatRequestExist8.replace(' ','')&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;$uri = "&lt;A href="https://api.hubspot.com/crm/v3/imports" target="_blank" rel="noopener"&gt;https://api.hubspot.com/crm/v3/imports&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;$filePath="E:\itAutomation\Hubspot\ToHubspot\New\"+$fileNameExist&lt;BR /&gt;$filePath2 = "/E:/itAutomation/Hubspot/ToHubspot/New/"+$fileNameExist&lt;/P&gt;&lt;P&gt;$fileBin = [System.IO.File]::ReadAlltext($filePath)&lt;BR /&gt;$boundary = [System.Guid]::NewGuid().ToString()&lt;BR /&gt;$LF = "`r`n"&lt;BR /&gt;$bodyLines = (&lt;BR /&gt;"--$boundary",&lt;BR /&gt;"Content-Disposition: form-data; name=`"importRequest`"$LF",&lt;BR /&gt;#"Content-Type: application/json;charset=utf-8$LF",&lt;BR /&gt;$formatRequestExist88,&lt;BR /&gt;"--$boundary",&lt;BR /&gt;"Content-Disposition: form-data; name=`"files`"; filename=`"$filePath2`"",&lt;BR /&gt;#"Content-Type: application/octet-stream$LF",&lt;BR /&gt;"Content-Type: text/csv$LF",&lt;BR /&gt;$fileBin,&lt;BR /&gt;"--$boundary--$LF"&lt;BR /&gt;) -join $LF&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"&lt;BR /&gt;$headers.Add("Content-Type", "multipart/form-data; boundary=`"$boundary`"")&lt;BR /&gt;$headers.Add("Authorization", "Bearer pat-na**********")&lt;/P&gt;&lt;P&gt;write-host "Headers"&lt;BR /&gt;$headers #| ConvertTo-Json}&lt;BR /&gt;write-host "Body"&lt;BR /&gt;$bodyLines&lt;/P&gt;&lt;P&gt;[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor&lt;BR /&gt;[Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12&lt;/P&gt;&lt;P&gt;Invoke-RestMethod -Uri $uri -Method Post -Headers $headers -Body $bodyLines&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CSV Source File:&lt;/P&gt;&lt;P&gt;firstName,lastName,email&lt;BR /&gt;Joe,Smith,jsmith99901@gmail.com&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;API Log Information&lt;/P&gt;&lt;P&gt;Request Header:&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"User-Agent": [&lt;BR /&gt;"Mozilla/5.0 (Windows NT; Windows NT 10.0; en-US) WindowsPowerShell/5.1.17763.1971"&lt;BR /&gt;],&lt;BR /&gt;"CDN-Loop": [&lt;BR /&gt;"cloudflare; subreqs=1"&lt;BR /&gt;],&lt;BR /&gt;"Accept-Encoding": [&lt;BR /&gt;"gzip"&lt;BR /&gt;],&lt;BR /&gt;"True-Client-IP": [&lt;BR /&gt;"1***"&lt;BR /&gt;],&lt;BR /&gt;"CF-Connecting-IP": [&lt;BR /&gt;"1***"&lt;BR /&gt;],&lt;BR /&gt;"X-HubSpot-Trace": [&lt;BR /&gt;"414c1a9d1cb0c2bff441a43caae3d5f9"&lt;BR /&gt;],&lt;BR /&gt;"Authorization": [&lt;BR /&gt;"Bearer pat-na******"&lt;BR /&gt;],&lt;BR /&gt;"X-HubSpot-Correlation-Id": [&lt;BR /&gt;"6899b906-ce85-455a-9d64-d63406738049"&lt;BR /&gt;],&lt;BR /&gt;"x-envoy-external-address": [&lt;BR /&gt;"1***"&lt;BR /&gt;],&lt;BR /&gt;"X-HS-Internal-Request": [&lt;BR /&gt;"1"&lt;BR /&gt;],&lt;BR /&gt;"Content-Length": [&lt;BR /&gt;"913"&lt;BR /&gt;],&lt;BR /&gt;"X-Real-IP": [&lt;BR /&gt;"1***"&lt;BR /&gt;],&lt;BR /&gt;"Content-Type": [&lt;BR /&gt;"multipart/form-data; boundary=\"556b036f-5eb0-4ec9-b41d-40df2ee79df3\""&lt;BR /&gt;],&lt;BR /&gt;"x-request-id": [&lt;BR /&gt;"6899b906-ce85-455a-9d64-d63406738049"&lt;BR /&gt;],&lt;BR /&gt;"cf-worker": [&lt;BR /&gt;"hubspot.com"&lt;BR /&gt;],&lt;BR /&gt;"CF-Ray": [&lt;BR /&gt;"82cb64ada28f169a-SJC"&lt;BR /&gt;],&lt;BR /&gt;"CF-IPCountry": [&lt;BR /&gt;"US"&lt;BR /&gt;],&lt;BR /&gt;"X-Forwarded-Proto": [&lt;BR /&gt;"https"&lt;BR /&gt;],&lt;BR /&gt;"Connection": [&lt;BR /&gt;"close"&lt;BR /&gt;],&lt;BR /&gt;"X-Request-Start": [&lt;BR /&gt;"1701098825.913"&lt;BR /&gt;],&lt;BR /&gt;"X-HS-Internal-User-Request": [&lt;BR /&gt;"0"&lt;BR /&gt;],&lt;BR /&gt;"Host": [&lt;BR /&gt;"api.hubspot.com"&lt;BR /&gt;],&lt;BR /&gt;"CF-Visitor": [&lt;BR /&gt;"{\"scheme\":\"https\"}"&lt;BR /&gt;],&lt;BR /&gt;"X-HS-User-Request": [&lt;BR /&gt;"0"&lt;BR /&gt;],&lt;BR /&gt;"CF-EW-Via": [&lt;BR /&gt;"15"&lt;BR /&gt;],&lt;BR /&gt;"X-Forwarded-Port": [&lt;BR /&gt;"443"&lt;BR /&gt;],&lt;BR /&gt;"X-Amzn-Trace-Id": [&lt;BR /&gt;"Root=1-6564b549-5795de530b252eec35288a92"&lt;BR /&gt;],&lt;BR /&gt;"X-Forwarded-For": [&lt;BR /&gt;"1****"&lt;BR /&gt;],&lt;BR /&gt;"x-envoy-expected-rq-timeout-ms": [&lt;BR /&gt;"60000"&lt;BR /&gt;],&lt;BR /&gt;"X-Scheme": [&lt;BR /&gt;"https"&lt;BR /&gt;]&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Request Body:&lt;/P&gt;&lt;P&gt;--556b036f-5eb0-4ec9-b41d-40df2ee79df3&lt;BR /&gt;Content-Disposition: form-data; name="importRequest"&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"name":"Batch_20231127_N",&lt;BR /&gt;"files":{&lt;BR /&gt;"fileFormat":"CSV",&lt;BR /&gt;"dateFormat":"YEAR_MONTH_DAY",&lt;BR /&gt;"fileImportPage":{&lt;BR /&gt;"hasHeader":true,&lt;BR /&gt;"columnMappings":[&lt;BR /&gt;{&lt;BR /&gt;"idColumnType":null,&lt;BR /&gt;"columnName":"firstName",&lt;BR /&gt;"propertyName":"firstname",&lt;BR /&gt;"columnObjectTypeId":"0-1"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"idColumnType":null,&lt;BR /&gt;"columnName":"lastName",&lt;BR /&gt;"propertyName":"lastname",&lt;BR /&gt;"columnObjectTypeId":"0-1"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"idColumnType":null,&lt;BR /&gt;"columnName":"email",&lt;BR /&gt;"propertyName":"email",&lt;BR /&gt;"columnObjectTypeId":"0-1"&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;},&lt;BR /&gt;"fileName":"Batch_20231127_N.csv"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;--556b036f-5eb0-4ec9-b41d-40df2ee79df3&lt;BR /&gt;Content-Disposition: form-data; name="files"; filename="/E:/itAutomation/Hubspot/ToHubspot/New/Batch_20231127_N.csv"&lt;BR /&gt;Content-Type: text/csv&lt;/P&gt;&lt;P&gt;firstName,lastName,email&lt;BR /&gt;Joe,Smith,jsmith99901@gmail.com&lt;/P&gt;&lt;P&gt;--556b036f-5eb0-4ec9-b41d-40df2ee79df3--&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Response Header:&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"Content-Type": [&lt;BR /&gt;"{\"type\":\"application\",\"subtype\":\"json\",\"parameters\":{\"charset\":\"UTF-8\"},\"wildcardType\":false,\"wildcardSubtype\":false}"&lt;BR /&gt;],&lt;BR /&gt;"X-HubSpot-RateLimit-Daily": [&lt;BR /&gt;"500000"&lt;BR /&gt;],&lt;BR /&gt;"X-HubSpot-RateLimit-Daily-Remaining": [&lt;BR /&gt;"499997"&lt;BR /&gt;],&lt;BR /&gt;"X-HubSpot-RateLimit-Interval-Milliseconds": [&lt;BR /&gt;"10000"&lt;BR /&gt;],&lt;BR /&gt;"X-HubSpot-RateLimit-Remaining": [&lt;BR /&gt;"149"&lt;BR /&gt;],&lt;BR /&gt;"X-HubSpot-RateLimit-Max": [&lt;BR /&gt;"150"&lt;BR /&gt;],&lt;BR /&gt;"X-HubSpot-RateLimit-Secondly": [&lt;BR /&gt;"15"&lt;BR /&gt;],&lt;BR /&gt;"X-HubSpot-RateLimit-Secondly-Remaining": [&lt;BR /&gt;"14"&lt;BR /&gt;]&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Response Body:&lt;/P&gt;&lt;P&gt;{"status":"error","message":"Unable to process JSON","correlationId":"6899b906-ce85-455a-9d64-d63406738049"}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 15:59:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Contacts-Build-Import-multipart-Unable-to-process-JSON-error/m-p/885101#M69317</guid>
      <dc:creator>BCamaglia</dc:creator>
      <dc:date>2023-11-27T15:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Contacts Build Import - multipart - Unable to process JSON error</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Contacts-Build-Import-multipart-Unable-to-process-JSON-error/m-p/885931#M69360</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello team, I would greatly appreciate any suggestions or recommendations you may have on this matter. Thank you in advance for your assistance.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2023 18:04:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Contacts-Build-Import-multipart-Unable-to-process-JSON-error/m-p/885931#M69360</guid>
      <dc:creator>IVallejo</dc:creator>
      <dc:date>2023-11-28T18:04:35Z</dc:date>
    </item>
  </channel>
</rss>

