Skip to main content
1-Visitor
July 4, 2021
Solved

Array in a JSON input

  • July 4, 2021
  • 1 reply
  • 3455 views

Hello there,

 

I am trying to send a JSON as input parameter of a service that I created, from Postman, but I get the following error message : 

"Unable To Parse JSON Request"
 
Here is the structure of my json : 
{
    "box" : 1531,
    "date" : "2021-07-01 14:19:48",
    "count" : [4,0]
}
 
So I selected the follow inputs for my service :
box -> number
date -> string
count -> ??? (I don't know what I have to put, I tried 2D, infotable, json, but nothing works...The parameter count is an array...)
 
Please could you help me to resolve my issue?
 
Best regards,
 
Thomas
Best answer by TonyZhang

Hi

Looks like you didn't format the body correctly in Postman and you need to change the Input Parameters to json type in ThingWorx service.

 

1 reply

16-Pearl
July 5, 2021

Hi, I copy and paste the json into a service's input parameter and it seems working just fine.

How did you send Json from Postman to the input parameter of a ThingWorx service?

Tjaf1-VisitorAuthor
1-Visitor
July 5, 2021

Hi,

 

Here there is my postman Body : (you will notice that I don't have variable, only parameters)

Tjaf_1-1625484456949.png

Here there is my ThingWorx service :

Tjaf_2-1625484968217.png

By this way it's not working...

 

I tried also to put a json as in input parameter but I don't have the name of the JSON variable (if you look at my postman POST), so I don't know how can I select my input parameter...

 

Thank you for your feedback.

 

TonyZhang16-PearlAnswer
16-Pearl
July 13, 2021

Hi

Looks like you didn't format the body correctly in Postman and you need to change the Input Parameters to json type in ThingWorx service.