Sample code for 30+ languages & platforms
Objective-C

Create JSON Array of Strings

See more JSON Examples

Demonstrates how to create a JSON array of strings.

Chilkat Objective-C Downloads

Objective-C
#import <CkoJsonArray.h>

// The goal of this example is to produce this:

// [
//   "tag1",
//   "tag2",
//   "tag3"
// ]

CkoJsonArray *jarr = [[CkoJsonArray alloc] init];
[jarr AddStringAt: [NSNumber numberWithInt: -1] value: @"tag1"];
[jarr AddStringAt: [NSNumber numberWithInt: -1] value: @"tag2"];
[jarr AddStringAt: [NSNumber numberWithInt: -1] value: @"tag3"];

jarr.EmitCompact = NO;
NSLog(@"%@",[jarr Emit]);