Http Request body creattion

Hi all ,
I need to excute the HTTP request activity using post method and into that i need to pass the body which looks a below
{
“demo1”:“123”,
“test”:“34”,
}
But Https activity need the body in a string format so can anyone share the syntax for the above body in C# as my framework is in C#

1 Like

Hey @vishal_nachankar

Here it is,

"{""demo1"":""123"",""test"":""34""}"

If it’s gonna be a long string, then better just add it in notepad & get the string from it.

Hope this helps.

Thanks
#nK

it is not working i need the syntax in C#

1 Like

Hey @vishal_nachankar

Sorry buddy, didn’t notice the C# mention. Thanks.

Here it is,

"{\"demo1\":\"123\",\"test\":\"34\"}"

Thanks
#nK

thanks for example suppose for any key if the value i dont need to pass in double quotes then what would be syntax can you share that if possible
{
“demo”:123,
“dasd”:“wqe”
}

1 Like

Hey @vishal_nachankar

You can just remove the escape character \ & double quotes "

"{\"demo1\":123,\"test\":\"34\"}"

Hope this helps.

Thanks
#nK

Could just explain if possible how did u do that

1 Like

Hey @vishal_nachankar

As explained, I just removed the quotes for a non-string value.

Double quotes " is like a reserved symbol for representing string so if we want to use the same inside any string text itself, compiler will get confused which is why we add an escape character which is \ to inform the compiler that this " should be ignored and not considered as reserved one.

Hope this helps.

Thanks
#nK

Ok thanks for the information it was great help

1 Like

Cool @vishal_nachankar :slight_smile: :+1:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.