From 1cd2a8b9342ffebc7fb78453fb7c09edfd9af31a Mon Sep 17 00:00:00 2001 From: Jessie Murray <61305023+jessie-murray@users.noreply.github.com> Date: Fri, 19 Mar 2021 18:31:24 -0700 Subject: [PATCH] Add support for REDIS_REPLY_STATUS in nested JSON (#189) When strings are added as elements of an array but typed as REDIS_REPLY_STATUS instead of REDIS_REPLY_STRING, Webdis encodes them as nulls. REDIS_REPLY_STATUS should only be encoded as [true, str] or [false, str] when this is a top-level status response, not an array element. In these cases we only need the string. Fixes #188 --- src/formats/json.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/formats/json.c b/src/formats/json.c index 707bc54..006bb1f 100644 --- a/src/formats/json.c +++ b/src/formats/json.c @@ -151,6 +151,7 @@ json_expand_array(const redisReply *r) { for(i = 0; i < r->elements; ++i) { e = r->element[i]; switch(e->type) { + case REDIS_REPLY_STATUS: case REDIS_REPLY_STRING: json_array_append_new(jlist, json_string(e->str)); break;