Currently facing an issue when making a JSON string in C# and trying to send it through to a web API using the WebClient.
Currently I have a few methods, first off the one that works. Using POSTMAN sending the following dataset of text through to the API works correctly:
POSTMAN Dataset - This Works in POSTMAN
{ "record": 
    {
        "form_id": "efe4f66f-b57c-4497-a370-25c0f3d8746a",
        "status": "240",
        "latitude": -82.638039,
        "longitude": 27.770787,
        "form_values": 
        {
            "833b": "99999",
            "683b": "9999999",
            "fa37": "Testing",
            "b2e3": "Testing"
        }
    }
}
In C# I am using a few different ways to construct this sting with little success.
C# List Method - Newtonsoft.Json.Serialization
The first is building a List and then using Newtonsoft.Json to play with it:
    List<Parent> DataList = new List<Parent>();
    List<Child> Form = new List<Child.formvalues>();
    var Formvals = new Child.formvalues
    {
        ActionDescription = Row.ActionDescription,
        ActionNotes = Row.ActionNotes,
        ActionID = Row.ActionID,
        AssetID = Row.AssetID
    };
    Form.Add(Formvals);
    var DataElement = new Parent
    {
        form_id = AppFormID,
        latitude = Lat,
        longitude = Long,
        status = Row.Status,
        form_values = Form
    };
    DataList.Add(DataElement);
    string json = JsonConvert.SerializeObject(DataList.ToArray());
This code results in the following string:
[
    {\"form_id\":\"efe4f66f-b57c-4497-a370-25c0f3d8746a\",
    \"latitude\":-82.638039,
    \"longitude\":27.770787,
    \"status\":239,
    \"form_values\":[
        {\"833b\":99999,
        \"683b\":9999999,
        \"fa37\":\"Testing\",
        \"b2e3\":\"Testing\"
        }]
    }
]
Another attempt I am trying is the following, which in my opinion is the closest so far:
C# - String Building Method
string Content = @"{ "
       + "\"record\": {"
       + "\"form_id\": "\"" + AppFormID + ""\","
       + "\"status\": "\"" + Row.Status + ""\","
       + "\"latitude\": "+ Lat  + ","
       + "\"longitude\": "+ Long + ","
       + "\"form_values\": {"
            + "\"833b\": "\""+Row.AssetID +""\","
            + "\"683b\": "\""+Row.ActionID + ""\","
            + "\"fa37\": "\""+Row.ActionDescription + ""\","
            + "\"b2e3\": "\""+Row.ActionNotes + ""\""
        + "}"
       + "}"
      + "}";
That line results in:
{ \"record\": 
    {
        \"form_id\": \"efe4f66f-b57c-4497-a370-25c0f3d8746a\",
        \"status\": \"239\",
        \"latitude\": -82.638039,
        \"longitude\": 27.770787,
        \"form_values\": 
        {
            \"833b\": \"99999\",
            \"683b\": \"9999999\",
            \"fa37\": \"Testing\",
            \"b2e3\": \"Testing\"
        }
  }
}
The Question!
So the question, is someone able to help me achieving the format in the first JSON that I put into POSTMAN exactly?
UPDATE - 6:40PM
Web client code c# AppURLRef is set in code further up and appears to be correct in the debugger. json is the result of the tests.
var http = new WebClient();
http.Headers.Add(HttpRequestHeader.ContentType, "application/json");
var response = http.UploadString(AppURLRef, "POST", json);
Result of Update
"[{\"record\":{\"form_id\":\"efe4f66f-b57c-4497-a370-25c0f3d8746a\",
\"latitude\":-82.638039,
\"longitude\":27.770787,
\"status\":\"240\",
\"form_values\":         
[{\"833b\":\"99999\",
\"683b\":\"9999999\",
\"fa37\":\"Testing\",
\"b2e3\":\"Testing\"}]}}]"
 
     
     
     
    