We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 85e8e46 + 75fa8d8 commit 39d959bCopy full SHA for 39d959b
src/helper.ts
@@ -134,6 +134,9 @@ function addDataType(
134
case "double":
135
updatedObjectWithDataType[key] = Number(input[key]);
136
break;
137
+ case "json":
138
+ updatedObjectWithDataType[key] = JSON.parse(input[key]);
139
+ break;
140
default:
141
updatedObjectWithDataType[key] = input[key];
142
}
test/index.test.ts
@@ -37,6 +37,7 @@ test("parse to json following ColumnInfo", async () => {
37
{ Name: "score4", Type: "int" },
38
{ Name: "rate1", Type: "float" },
39
{ Name: "rate2", Type: "double" },
40
+ { Name: "metadata", Type: "json" },
41
],
42
},
43
Rows: [
@@ -52,6 +53,7 @@ test("parse to json following ColumnInfo", async () => {
52
53
{ VarCharValue: "score4" },
54
{ VarCharValue: "rate1" },
55
{ VarCharValue: "rate2" },
56
+ { VarCharValue: "metadata" },
57
58
59
{
@@ -65,6 +67,12 @@ test("parse to json following ColumnInfo", async () => {
65
67
{ VarCharValue: "104" },
66
68
{ VarCharValue: "1.01" },
69
{ VarCharValue: "1.02" },
70
+ {
71
+ VarCharValue: JSON.stringify({
72
+ key1: "value1",
73
+ key2: "value2",
74
+ }),
75
+ },
76
77
78
@@ -86,6 +94,7 @@ test("parse to json following ColumnInfo", async () => {
86
94
score4: 104,
87
95
rate1: 1.01,
88
96
rate2: 1.02,
97
+ metadata: { key1: "value1", key2: "value2" },
89
98
});
90
99
91
100
0 commit comments