patch 9.1.1232: Vim script is missing the tuple data type

Problem:  Vim script is missing the tuple data type
Solution: Add support for the tuple data type
          (Yegappan Lakshmanan)

closes: #16776

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/json.c b/src/json.c
index 66b8bf9..faa35e5 100644
--- a/src/json.c
+++ b/src/json.c
@@ -267,6 +267,7 @@
     char_u	*res;
     blob_T	*b;
     list_T	*l;
+    tuple_T	*tuple;
     dict_T	*d;
     int		i;
 
@@ -369,6 +370,42 @@
 	    }
 	    break;
 
+	case VAR_TUPLE:
+	    tuple = val->vval.v_tuple;
+	    if (tuple == NULL)
+		ga_concat(gap, (char_u *)"[]");
+	    else
+	    {
+		if (tuple->tv_copyID == copyID)
+		    ga_concat(gap, (char_u *)"[]");
+		else
+		{
+		    int		len = TUPLE_LEN(tuple);
+
+		    tuple->tv_copyID = copyID;
+		    ga_append(gap, '[');
+		    for (i = 0; i < len && !got_int; i++)
+		    {
+			typval_T	*t_item = TUPLE_ITEM(tuple, i);
+			if (json_encode_item(gap, t_item, copyID,
+						   options & JSON_JS) == FAIL)
+			    return FAIL;
+
+			if ((options & JSON_JS)
+				&& i == len - 1
+				&& t_item->v_type == VAR_SPECIAL
+				&& t_item->vval.v_number == VVAL_NONE)
+			    // add an extra comma if the last item is v:none
+			    ga_append(gap, ',');
+			if (i <= len - 2)
+			    ga_append(gap, ',');
+		    }
+		    ga_append(gap, ']');
+		    tuple->tv_copyID = 0;
+		}
+	    }
+	    break;
+
 	case VAR_DICT:
 	    d = val->vval.v_dict;
 	    if (d == NULL)