I am trying to serialize a C # object to a Json object. This will then be presented in the Salesforce API and create the application. Right now I have a C # object serialized to a Json string, but I need it to be an object.
Here is my C # object and serialization support.
Customer application = new Customer { ProductDescription = "gors_descr " + tbDescription.Text, Fname = "b_name_first " + tbFName.Text, Lname = "b_name_last " + tbLName.Text }; var json = new System.Web.Script.Serialization.JavaScriptSerializer(); string jsonString = json.Serialize(application); string endPoint = token.instance_url + "/services/apexrest/submitApplication/"; string response = conn.HttpPost(endPoint, json, token); Literal rLiteral = this.FindControl("resultLiteral") as Literal;
I need a JSON string to output inside a JSON object. Below is an example of what I need:
"{ \"jsonCreditApplication\" : " + "\"gors_descr\" : \"Appliances\", " + "\"b_name_first\" : \"Marisol\", " + "\"b_name_last\" : \"Testcase\", " + "}";
This hardcoded json string is inside the object. Be that as it may, the values ββin the C # object are output to the JSON string, but I need it to be output to the object for the Salesforce API to accept the view.
How to add or insert a JSON string in an object?
json c # api serialization
Mowrite
source share