Sample code for 30+ languages & platforms
C++

Example: Http.GetLastJsonData method

Demonstrates the GetLastJsonData method.

Chilkat C++ Downloads

C++
#include <CkHttp.h>
#include <CkHttpResponse.h>
#include <CkJsonObject.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkHttp http;
    CkHttpResponse resp;

    //  Only allow TLS 1.2 or better.
    http.put_SslProtocol("TLS 1.2 or higher");

    success = http.HttpNoBody("GET","https://google.com/",resp);
    if (success == false) {
        std::cout << http.lastErrorText() << "\r\n";
        return;
    }

    CkJsonObject json;
    json.put_EmitCompact(false);

    http.GetLastJsonData(json);
    std::cout << json.emit() << "\r\n";

    //  Output as of Chilkat v11.1.0
    //  Additional information may be added as requested or needed in future versions of Chilkat.

    //  {
    //    "tls": {
    //      "params": {
    //        "sniHostname": "www.google.com",
    //        "allowConnectionOnlyIfServerChooses": "TLS 1.2 or higher"
    //      },
    //      "negotiatedTlsVersion": "TLS 1.3"
    //    }
    //  }
    }