Sample code for 30+ languages & platforms
Objective-C Requires Chilkat v11.0.0+

Example: Http.GetLastJsonData method

Demonstrates the GetLastJsonData method.

Chilkat Objective-C Downloads

Objective-C
#import <CkoHttp.h>
#import <CkoHttpResponse.h>
#import <CkoJsonObject.h>

BOOL success = NO;

CkoHttp *http = [[CkoHttp alloc] init];
CkoHttpResponse *resp = [[CkoHttpResponse alloc] init];

//  Only allow TLS 1.2 or better.
http.SslProtocol = @"TLS 1.2 or higher";

success = [http HttpNoBody: @"GET" url: @"https://google.com/" response: resp];
if (success == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

CkoJsonObject *json = [[CkoJsonObject alloc] init];
json.EmitCompact = NO;

[http GetLastJsonData: json];
NSLog(@"%@",[json Emit]);

//  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"
//    }
//  }