PHP
Chilkat2 PHP
JSON Append String Array
See more JSON Examples
Demonstrates how to append an array of strings from a string table object.Note: This example uses the AppendStringTable method, which was introduced in Chilkat v9.5.0.67
Chilkat PHP Downloads
<?php
use Chilkat2\JsonObject;
use Chilkat2\StringTable;
$json = new JsonObject();
$json->EmitCompact = false;
$json->AppendString('abc', '123');
$st = new StringTable();
$st->Append('a');
$st->Append('b');
$st->Append('c');
$st->Append('d');
$json->AppendStringArray('strArray', $st);
echo $json->Emit(), "\n";
// Output:
// {
// "abc": "123",
// "strArray": [
// "a",
// "b",
// "c",
// "d"
// ]
// }