Sample code for 30+ languages & platforms
C#

Transition from Http.PostJson2 to Http.HttpStr

Provides instructions for replacing deprecated PostJson2 method calls with HttpStr.

Chilkat C# Downloads

C#
bool success = false;

Chilkat.Http http = new Chilkat.Http();

string url = "https://example.com/something";
string contentType = "application/json";
string jsonText = "{ ... }";

//  ------------------------------------------------------------------------
//  The PostJson2 method is deprecated:

Chilkat.HttpResponse responseObj = http.PostJson2(url,contentType,jsonText);
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

//  ...
//  ...

//  ------------------------------------------------------------------------
//  Do the equivalent using HttpStr.
//  Your application creates a new, empty HttpResponse object which is passed 
//  in the last argument and filled upon success.

Chilkat.HttpResponse responseOut = new Chilkat.HttpResponse();
success = http.HttpStr("POST",url,jsonText,"utf-8",contentType,responseOut);
if (success == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}