Skip to content

cyaml_json() is missing commas between sequence items - #4

Merged
andrewmd5 merged 1 commit into
andrewmd5:mainfrom
yasuoka:fix-cymaml_json-sequence
Aug 24, 2026
Merged

cyaml_json() is missing commas between sequence items#4
andrewmd5 merged 1 commit into
andrewmd5:mainfrom
yasuoka:fix-cymaml_json-sequence

Conversation

@yasuoka

@yasuoka yasuoka commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

cyaml_json() does not emit commas between sequence items when generating JSON.

test code:

#include <cyaml.h>
#include <stdio.h>

int
main(int argc, char *argv[])
{
	cyaml_doc_t	*doc;
	cyaml_node_t	*root, *test;

	doc = cyaml_doc_new();
	root = cyaml_new_map(doc);
	test = cyaml_new_seq(doc);
	cyaml_seq_push(test, cyaml_new_int(doc, 1));
	cyaml_seq_push(test, cyaml_new_int(doc, 2));
	cyaml_seq_push(test, cyaml_new_int(doc, 3));
	cyaml_seq_push(test, cyaml_new_int(doc, 4));
	cyaml_map_set(doc, root, "test", test);
	cyaml_set_root(doc, root);

	printf("%s", cyaml_json(doc, 2, NULL));	
}

result:

% ./a.out
{
  "test": [
    1    2    3    4
  ]
}
%

comma (,) is missing between items.

after the diff:

% ./a.out
{
  "test": [
    1,
    2,
    3,
    4
  ]
}
%

@yasuoka
yasuoka force-pushed the fix-cymaml_json-sequence branch from 53e86e5 to 647ae04 Compare July 26, 2026 10:13
@andrewmd5
andrewmd5 merged commit 7fb5b32 into andrewmd5:main Aug 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants