The problem is that you're using strlen instead of charsmax.
Code:
json_serial_to_string(playersJson, buf, strlen(buf))
Since you didn't assign any string to the buf variable, strlen will return 0. The third parameter of json_serial_to_string is:
Code:
maxlen - Maximum size of the buffer
You're literally doing this:
Code:
json_serial_to_string(playersJson, buf, 0);
// copy up to 0 characters
charsmax will return the size of the buffer - 1 for the null terminator, in your case 3072 - 1 (3071) and will copy up to 3070 characters.
By the way, you should probably call json_free() on the playerObject variable after each iteration.
Code:
new JSON:playerObject = json_init_object();
json_object_set_string(playerObject, "steamid", "1234");
json_object_set_string(playerObject, "name", "plaf");
json_array_append_value(argsJson, playerObject);
json_free(playerObject)
__________________