From 01624fea229c3c5385d2b31a77844c5848a485b8 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 12 Oct 2021 13:43:19 +0800 Subject: [PATCH] [TD-10532]: schemaless fix inserting one datapoint error in JSON Array --- src/client/src/tscParseOpenTSDB.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/src/tscParseOpenTSDB.c b/src/client/src/tscParseOpenTSDB.c index d838603700..ec22a9dc8a 100644 --- a/src/client/src/tscParseOpenTSDB.c +++ b/src/client/src/tscParseOpenTSDB.c @@ -1003,7 +1003,7 @@ static int32_t tscParseMultiJSONPayload(char* payload, SArray* points, SSmlLines for (int32_t i = 0; i < payloadNum; ++i) { TAOS_SML_DATA_POINT point = {0}; - cJSON *dataPoint = (payloadNum == 1) ? root : cJSON_GetArrayItem(root, i); + cJSON *dataPoint = (payloadNum == 1 && cJSON_IsObject(root)) ? root : cJSON_GetArrayItem(root, i); ret = tscParseJSONPayload(dataPoint, &point, info); if (ret != TSDB_CODE_SUCCESS) { -- GitLab