toJson

语法

toJson(X)

参数

X 可以是任意数据类型。

详情

将DolphinDB对象转换为JSON字符串。该JSON字符串包含了5个键值对:name(变量名),form(数据结构),type(数据类型),size(长度),value(值)。

例子

$ x=1 2 3
$ y=toJson(x)
$ y;
{"name":"x","form":"vector","type":"int","size":"3","value":[1,2,3]}

$ t=table(1 2 3 as id, 10 20 30 as val)
$ toJson(t);
{"name":"t","form":"table","size":"3","value":[{"name":"id","form":"vector","type":"int","size":"3","value":[1,2,3]},{"name":"val","form":"vector","type":"int","size":"3","value":[10,20,30]}]}

相关函数:fromJson