Click here to Skip to main content
15,886,795 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Friends

I want to Add Value of Enc_DEPCODE dynamically in this string given below :

string json1 = @"{""DEPCODE"":"" Enc_DEPCODE ""}";

What I have tried:

i Want to Create JSON Sting using C# code without using any other tool or class.
i have tried so many methods.kindly any one know then help me
Posted
Updated 2-Oct-20 5:12am
Comments
F-ES Sitecore 2-Oct-20 10:39am    
What's wrong with the code you are using now?
ZurdoDev 2-Oct-20 10:57am    
Just add it in. Or, create a class and serialize and then deserialze.
Richard Deeming 2-Oct-20 11:00am    
"without using any other tool or class"
For what possible reason? Unless your code is running on an embedded microcontroller with extremely limited space, why do you want to reinvent the wheel?

And if it is running on a limited microcontroller, then a managed language like .NET is probably not the best place to start anyway.
[no name] 2-Oct-20 11:08am    
Since we don't know your "many methods", expect more of the same.

1 solution

C#
string json1 = string.Format("{\"DEPCODE\":\"{0)\"]", Enc_DEPCODE);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900