# Pass the Parameter / Variable in Http Request Body

**URL:** <https://forum.uipath.com/t/pass-the-parameter-variable-in-http-request-body/771690>\
**Category:** Studio\
**Tags:** activities-panel, question, studio, webapi, activities\
**Created:** [October 6, 2024, 10:19am UTC](https://forum.uipath.com/t/pass-the-parameter-variable-in-http-request-body/771690 "2024-10-06T10:19:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naresh\_Upadhyay](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/naresh_upadhyay/32/179323_2.png) [@Naresh\_Upadhyay](https://forum.uipath.com/u/Naresh_Upadhyay)\
**Post date:** [October 6, 2024, 10:19am UTC](https://forum.uipath.com/t/pass-the-parameter-variable-in-http-request-body/771690/1 "2024-10-06T10:19:46Z")

</div>

Hi Team

I have a Json payload that needs to be place in http request body and now facing following challenges.

Tried to pass the Json payload directly in body but it’s thawing Compiler error.

Therefore, I put the json payload in Notepad file and then ready that file and save into a String variable. Now, I would like to pass the variable / parameter in that Json payload

Can someone please help me to pass the variable in the payload or pass the json payload in http request body?

Thanks  
Naresh

---

<div class="post-metadata">

**Author:** ![ashokkarale](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ashokkarale/32/474400_2.png) [@ashokkarale](https://forum.uipath.com/u/ashokkarale)\
**Post date:** [October 6, 2024, 10:25am UTC](https://forum.uipath.com/t/pass-the-parameter-variable-in-http-request-body/771690/2 "2024-10-06T10:25:40Z")

</div>

@Naresh_Upadhyay,

Can you share how the json payload looks like and which value you are trying to replace by variable?

---

<div class="post-metadata">

**Author:** ![Naresh\_Upadhyay](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/naresh_upadhyay/32/179323_2.png) [@Naresh\_Upadhyay](https://forum.uipath.com/u/Naresh_Upadhyay)\
**Post date:** [October 6, 2024, 11:26am UTC](https://forum.uipath.com/t/pass-the-parameter-variable-in-http-request-body/771690/3 "2024-10-06T11:26:00Z")

</div>

Here it is. I would like to replace legalEntity value.

{  
“orderFrieghtAnalysis”:[  
/_{  
“salesId”:“”,  
“deliveryMode”:“UPS-Ex-P”,  
“deliveryModeName”:“UPS Express Plus”,  
“overrideCode”:“”,  
“shippingAmt”:103.4,  
“suggestedAmt”:103.4,  
“shippingCost”:93.15,  
“levelWeight”:2.58,  
“custFreightAcct”:“”,  
“overrideCodeDesc”:“”,  
“levelName”:“01”,  
“residentialChargeProposed”:0,  
“outOfAreaChargeProposed”:0  
}_/  
],  
“orderHeaderId”:“”,  
“legalEntity”:“ZUKL”,  
“currencyCode”:“USD”,  
“companyName”:“AUTOMATION ZUKL TEST ACCOUNT”,  
“aeId”:“e8e751a9-08d8-eb11-bacb-000d3a17efe1”,  
“aeName”:“User 18756487351”,  
“aMPersonalNumber”:“010900”,  
“billingAddressId”:“1e46994a-6e59-ef11-bfe2-6045bda803e7”,  
“accountId”:“02397cff-6859-ef11-a316-000d3a98c397”,  
“accountBusinessUnit”:“800”,  
“accountCostCenter”:“120099”,  
“actionType”:188190002,  
“customerAccount”:“2000003042”,  
“customerRef”:“”,  
“department”:“1200”,  
“invoiceAmount”:“144.40”,  
“isGamOrder”:true,  
“justificationComments”:“”,  
“justificationReason”:1,  
“leasingAccountNumber”:“”,  
“modifiedSource”:“OMS”,  
“orderDate”:“”,  
“orderLimit”:0,  
“orderType”:188190000,  
“paymentMode”:“OA”,  
“purchOrderFormNum”:“vk\_test”,  
“expeditedFulfillment”:false,  
“includedForCommission”:false,  
“includeStandingEmailRecipients”:true,  
“quoteExpirationDate”:“2024-09-30”,  
“taxExemptionType”:“”,  
“additionalEmails”:“”,  
“soBuyer”:“”,  
“futureReleaseDate”:“2024-09-22”,  
“additionalShippingConfirmationEmails”:“”,  
“giftReceipt”:false,  
“manualMgrReviewFlag”:false,  
“managerReview”:false,  
“holdFulfillment”:false,  
“quoteName”:“”,  
“waitForCustomer”:false,  
“onyxId”:“200004784”,  
“isInterCompanySalesOrder”:false,  
“salesId”:“”,  
“brokerFeesType”:“Fixed”,  
“markupTransheaders”:null,  
“opportunityId”:“”,  
“recId”:0,  
“language”:“en-GB”,  
“quoteStatus”:“”,  
“zonOverrideFinancialDimension”:“No”,  
“zonSuppressInvoice”:“No”,  
“confirmationStatus”:“Yes”,  
“billCompleted”:“No”,  
“salesType”:“Journal”,  
“salesOrigin”:“Assisted”,  
“orderSource”:“CRM”,  
“cIMSCustomerId”:“0”,  
“cIMSProjectCode”:“”,  
“cIMSProjectId”:“0”,  
“cIMSProjectName”:“”,  
“lastFourDigitCreditCardNumber”:“”,  
“costTo”:“”,  
“lOBCostcenter”:“”,  
“lOBDepartment”:“”,  
“miscData1”:“”,  
“miscData2”:“”,  
“miscData3”:“”,  
“miscData4”:“”,  
“miscData5”:“”,  
“projectId”:“”,  
“projectType”:“”,  
“sendQuote”:null,  
“loggedInUserId”:“693BC25D-6389-EE11-8179-6045BDD735D9”,  
“isLimitedModified”:false,  
“isUpdated”:false,  
“deleteOrderLevelsIds”:[

],  
“deleteOrderLinesIds”:[

],  
“deleteCommentsIds”:[

],  
“deleteOrderLineCommentsIds”:[

],  
“deleteCustomizationNoteIds”:[

],  
“deleteAttachDocumentIds”:[

],  
“deleteOrderAssistsIds”:[

],  
“deleteOrderFrieghtAnalysisIds”:[

],  
“deleteOrderLineRecIds”:[

],  
“deleteAssistRecIds”:[

],  
“deleteCommentRecIds”:[

],  
“orderLevels”:[  
{  
“orderLevelId”:“”,  
“modifiedSource”:“OMS”,  
“deliveryContactName”:“ZUKL CONTACT1”,  
“deliveryContactPhone”:“+44 1214960497”,  
“customerFreightAccount”:“”,  
“overrideFreightAmount”:0,  
“overrideFreightCharge”:false,  
“shippingCost”:“93.15”,  
“shippingMethodCode”:“UPS-Ex-P”,  
“shippingMethodName”:“UPS Express Plus”,  
“shippingRate”:“103.40”,  
“shippingAmt”:“103.40”,  
“isOverNight”:true,  
“[deliveryEmail":"zuklc1@Test.com](mailto:deliveryEmail%22:%22zuklc1@Test.com)”,  
“deliveryAddressLine”:“AUTOMATION ZUKL TEST ACCOUNT”,  
“deliveryAddressStreet”:“CRAWLEY BUSINESS QUARTER MANOR ROYAL”,  
“deliveryAddressCity”:“CRAWLEY”,  
“deliveryAddressState”:“FN”,  
“deliveryAddressCountry”:“GBR”,  
“deliveryAddressZipCode”:“RH10 9AD”,  
“shippingAddress”:“e91ed579-1d5e-ef11-bfe3-000d3a4ef5bd”,  
“soLevel”:“01”,  
“orderHeaderOrderLevelId”:“”,  
“termsOfDeliveryCode”:“DDP”,  
“termsOfDeliveryDescription”:“Delivered Duty Paid”,  
“contactId”:“00e0c223-6959-ef11-a316-000d3a98c397”,  
“holdToComplete”:false,  
“orderLines”:[  
{  
“isLineModifiable”:true,  
“orderLineComments”:[

```
           ],
           "orderLineId":"",
           "recId":0,
           "stopped":"No",
           "modifiedSource":"OMS",
           "itemId":"301134506",
           "productNumber":"301134506NEW",
           "dellQuoteId":"",
           "ceDellQuoteId":"",
           "dellQuoteExpiryDate":"1900-01-01",
           "primaryVendorId":"",
           "dellQuoteCost":0,
           "minPrice":39.38,
           "osrAmount":0,
           "itemName":"DELL Latitude 5440 Intel Core i5 i5-1345U Laptop",
           "name":"DELL Latitude 5440 Intel Core i5 i5-1345U Laptop",
           "configuration":"NEW",
           "customizationNoteCode":"SPDI",
           "customizationNoteReqd":0,
           "customizationNote":[
              {
                 "id":"",
                 "field":"MfrPartNumber",
                 "label":"Hold Number",
                 "fieldType":"string",
                 "controlType":"text",
                 "value":"",
                 "saleId":"",
                 "orderLineId":"",
                 "recId":0
        //
              },
              {
                 "id":"",
                 "field":"SpecialInstructions",
                 "label":"Special Instructions",
                 "fieldType":"string",
                 "controlType":"text",
                 "value":"",
                 "saleId":"",
                 "orderLineId":"",
                 "recId":0
        //
              },
              {
                 "id":"",
                 "field":"Description",
                 "label":"Case ID",
                 "fieldType":"string",
                 "controlType":"text",
                 "value":"",
                 "saleId":"",
                 "orderLineId":"",
                 "recId":0
        //
              }
           ],
           "mfrPartNumber":"5JC7R",
           "sku":"301134506-NEW",
           "manufacturerName":"DELL",
           "currencyCode":"USD",
           "weight":2.58,
           "wareHouse":"UKDSHIP",
           "site":"1",
           "recycleFeePrice":0,
           "recycleFeeReqd":false,
           "recycleFeeCode":"",
           "vpaPrice":41,
           "salesQty":1,
           "listPrice":44.62,
           "isWebStandard":0,
           "spa":"",
           "contractFee":"0",
           "contractID":"",
           "contractNumber":"",
           "internalContractName":"",
           "formalContractName":"",
           "salesPrice":41,
           "salesCost":39.38,
           "lineNumber":1,
           "appleDepLinkedItemId":0,
           "orderHeaderId":"",
           "orderLevelId":"",
           "displaySequence":1,
           "lineId":"",
           "landedCost":39.38,
           "landedCostPercent":0,
           "netLandedCost":"39.38",
           "webPrice":41,
           "needByDateQualifier":"0",
           "needByDate":null,
           "isFinishedGood":false,
           "isTSCService":false,
           "statusCode":0,
           "stateCode":0,
           "extCustProductNumber":"",
           "extPOLineNumber":"",
           "reviewQueue":"",
           "isInsideDelivery":0,
           "isLiftGateDelivery":0,
           "isProofRequireSignatureAdult":0,
           "isCustomerStandard":0,
           "wYType":0,
           "linkedWYLineNumber":0,
           "wYLineRefId":"",
           "deleteNoteRecIds":[
              
           ],
           "deleteLineCommentRecIds":[
              
           ],
           "bHConfigItem":"",
           "bAHItemId":"",
           "isBAHConfig":false,
           "isWsServiceItem":false,
           "lineStatus":"F1",
           "margin":"3.95"
        }
     ]
  }

```

]  
}

---

<div class="post-metadata">

**Author:** ![ashokkarale](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ashokkarale/32/474400_2.png) [@ashokkarale](https://forum.uipath.com/u/ashokkarale)\
**Post date:** [October 6, 2024, 11:51am UTC](https://forum.uipath.com/t/pass-the-parameter-variable-in-http-request-body/771690/4 "2024-10-06T11:51:44Z")

</div>

@Naresh_Upadhyay,

Will the legal entity value going to be 4 character always?

---

<div class="post-metadata">

**Author:** ![Naresh\_Upadhyay](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/naresh_upadhyay/32/179323_2.png) [@Naresh\_Upadhyay](https://forum.uipath.com/u/Naresh_Upadhyay)\
**Post date:** [October 6, 2024, 12:07pm UTC](https://forum.uipath.com/t/pass-the-parameter-variable-in-http-request-body/771690/5 "2024-10-06T12:07:02Z")

</div>

Yes, 4 characters only.

---

<div class="post-metadata">

**Author:** ![ashokkarale](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ashokkarale/32/474400_2.png) [@ashokkarale](https://forum.uipath.com/u/ashokkarale)\
**Post date:** [October 6, 2024, 1:10pm UTC](https://forum.uipath.com/t/pass-the-parameter-variable-in-http-request-body/771690/6 "2024-10-06T13:10:23Z")

</div>

@Naresh_Upadhyay,

Follow these steps:

1. Deserialize JSON  
`jObject = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Newtonsoft.Json.Linq.JObject)(strInputJSON)`

2. Assign new value to `legalEntity`  
`jObject("legalEntity") = yourVariable`

3. Serialize JSON  
`strJsonString = JsonConvert.SerializeObject(jObject)`

 ![This image depicts a flowchart illustrating the process of reading a text file, manipulating a JSON object by adding a "legalEntity" key/value, and then serializing the updated JSON object to a string. (Captioned by AI)](https://global.discourse-cdn.com/uipath/original/4X/9/0/6/90622217d7c1144dd3e40d87d30e9b2931775173.png)

**Before** :

 ![The image displays a JSON input with order freight analysis details, highlighting the "legalEntity" parameter set to "ZUKL." (Captioned by AI)](https://global.discourse-cdn.com/uipath/original/4X/4/c/9/4c9cb95c7c461a077ed22db9aa704ec2e3efcc32.png)

**After** :

 ![The image contains a screenshot of a JSON string within a code editor's immediate window, highlighting the "legalEntity" field with the value "ABCD". (Captioned by AI)](https://global.discourse-cdn.com/uipath/original/4X/b/f/1/bf16b6b4658183c2d6b4e19ead79ca822c733128.png)

Sample Code:  
[Workflow1.xaml](https://forum.uipath.com/uploads/short-url/c1A3DwixwHN01axNsGNnjBePZ5s.xaml) (15.7 KB)

Thanks,  
Ashok 🙂

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [October 6, 2024, 4:53pm UTC](https://forum.uipath.com/t/pass-the-parameter-variable-in-http-request-body/771690/7 "2024-10-06T16:53:24Z")

</div>

@Naresh_Upadhyay

If you are using data from file then use a placeholder inplace of value and use replace

For example place holder can be `<LegalEntity>`

Then use `str.Replace("<LegalEntity>",yourVariable)` here str is the string read from Text file

Cheers
