cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
okkajoo
New Member

Getting "JSON malformed" error when trying to PUT data via HTTP

Hi,

 

I'm trying to send a simple JSON via HTTP "PUT" command, but keep getting the following error:

 

{
  "errortext""JSON malformed in line 1, position 1. JSON malformed. Was expecting: \" 0-9 null true false { [.",
  "errornumber"7
}
 
The very original JSON which have worked on other software is (host censored):
 
PUT /connector/relations/handleRelation HTTP/1.1
Host: XXX.XXXX.fi
Authorization: Basic c29hcDpzb2Fw
Content-Length: 145
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
 
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data"
 
{"company": "Test Company"}
----WebKitFormBoundary7MA4YWxkTrZu0gW
 
I have tried to simply copy/paste this into body field, and also tried to type the headers into the "Headers" field on HTTP task but no change whatsoever.
 
Does anyone have idea what could cause the "JSON malformed" error, and what would be the right structure for the JSON?
 
Thanks in advance!
1 ACCEPTED SOLUTION

Accepted Solutions
okkajoo
New Member

Hello @joe_hannes_col !

 

Thanks for the reply, but I just actually found a "workaround" to this with my colleague.

 

We used POST instead of PUT and used the webhook to get things working:

 

http.png

Data is taken from chat bot working on our ms teams (objects are in Finnish)

 

Seems like this HTTP tool doesn't support form-data as it is?

View solution in original post

3 REPLIES 3
joe_hannes_col
Continued Contributor
Continued Contributor

Hello @okkajoo,

 

I think the body of your request should contain

{"company": "Test Company"}

The rest, like Content-Type, Content-Dispostion etc. should go into the headers.

okkajoo
New Member

Hello @joe_hannes_col !

 

Thanks for the reply, but I just actually found a "workaround" to this with my colleague.

 

We used POST instead of PUT and used the webhook to get things working:

 

http.png

Data is taken from chat bot working on our ms teams (objects are in Finnish)

 

Seems like this HTTP tool doesn't support form-data as it is?

View solution in original post

joe_hannes_col
Continued Contributor
Continued Contributor

Great you made it work, @okkajoo!

I'm not aware of any limitations regarding the use of form-data, but my requests have always been in JSON so far 🙂

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (985)