Pass raw Json data in the Htto Body section

Hi,
I’m trying to pass following sample JSON into Http Body section, and still getting error “Please provide valid JSON Input”.
Json should be pass as raw in Body section.
I have replaced " with single ’ , still it’s not accepting json.
Sample Json is also on the one line:

“{‘id’: null,‘model_year’: ‘2022’,‘brand_id’: ‘3’,‘model’: ‘CP33003-Camera’,‘OtherDetail’: ‘Built in Japan’,‘location_id’: ‘1’,‘order_no’: ‘ZNZ57’,‘options’: null,‘color’: ‘White’,‘ca’: ‘127'’,‘gvw’: ‘14,500’,‘engine’: ‘6.6L Gas’,‘transmission’: ‘A’,‘cash_rewards’: null,‘demo’: ‘0’,‘production_type’: ‘0’,‘on_hold’: ‘0’,‘hold_date’: null,‘hold_customer’: null,‘hold_comments’: ‘this will insert’,‘number_of_photos’: ‘0’,‘has_invoice’: ‘0’,‘plant_date’: null,‘recv_date’: null,‘hold_expiry_24hr_notification’: ‘0’,‘hold_expiry_12hr_notification’: ‘0’,‘plant_code’: ‘ABC’,‘factory_order_number’: ‘101’,‘sales_order_number’: ‘100’}”

Thanks,
Shantanu

Hello,

To add " into a string you can escape the double quotes with another double quotes like this → “”
So, your string will change into → “{”“id”“: null,”“model_year”“:”“2022"”,““brand_id””: ““3"” … }”

Also, do not copy these double quotes from forum, because the formatting can be different and it’ll throw an error.

@artshoque , no it’s not working, already tried. saying : Please provide valid JSON input.

Hello,
Check this video to see how you build safe JSON in UiPath using VB.NET:

Thanks,
Cristian

1 Like

Hi @Shantanu_More
Best method for this case is , store the json body in notepad, then using Read Text File Activity, read the text file and store in string variable. then assign that string variable in json body section of HTTP Request. This will solve your issue

Regards,
Nived N
Happy Automation