faster json decode

This commit is contained in:
2026-02-12 17:06:48 -06:00
parent add136c140
commit 19524b3a53
3 changed files with 3 additions and 7 deletions

View File

@@ -5221,7 +5221,8 @@ static JSValue cjson_to_jsvalue (JSContext *ctx, const cJSON *item) {
if (cJSON_IsString (item)) return JS_NewString (ctx, item->valuestring);
if (cJSON_IsArray (item)) {
int n = cJSON_GetArraySize (item);
JSValue arr = JS_NewArray (ctx);
JSValue arr = JS_NewArrayLen (ctx,n);
printf("array size %d\n", n);
for (int i = 0; i < n; i++) {
cJSON *child = cJSON_GetArrayItem (item, i);
JS_SetPropertyNumber (ctx, arr, i, cjson_to_jsvalue (ctx, child));