- if (subcommand_output.json_output) {
- DLOG("Subcommand JSON output: %s\n", subcommand_output.json_output);
- char *buffer;
- /* In the beginning, the contents of json_output are "[\0". */
- if (command_output.json_output[1] == '\0')
- sasprintf(&buffer, "%s%s", command_output.json_output, subcommand_output.json_output);
- else sasprintf(&buffer, "%s, %s", command_output.json_output, subcommand_output.json_output);
- free(command_output.json_output);
- command_output.json_output = buffer;
- DLOG("merged command JSON output: %s\n", command_output.json_output);
- }