Hi,
There is one scenario where I want to pass null value into json body in http request. How can I do that?
Please suggest…
Hi @Nisha_K21
Check the below thread
HI @Nisha_K21
Use a simple JsonConvert.SerializeObject(jsonText)…
To obtain data string like that :
“[{“ReceipNoteId”: 0, “ReceiptNoteNumber”: null, “DeliveryDate”: null, “SiteId”: 0, “SiteName”:“AC0001”, “SupplierName”:“JohnDoe”, “SupplierId”: 0, “DeliveryNumber”: null}]”
Thanks,
Purushorham
I tried above methods by giving null as value but sometimes it will throw an error and sometimes won’t
Uploading: IMG20240905160750.jpg…
Does anyone know the solution of this?
Hi @Nisha_K21
Please collect all the data into Dictionary
dictJson = New Dictionary(Of String, Object)
dictJson("KeyToBeNull") = Nothing
convert the dictionary to JSON
Newtonsoft.Json.JsonConvert.SerializeObject(dictJson)
Note: Please share your expected form of JSON and will help you with the solutions.
Thanks,
Chethan