select fromJson(val)时提示The data form is not supported异常

在DolphinDB database中有下面代码:

x1='{"name":"","form":"scalar","type":"double","value":"2.1E+5"}'
x2='{"name":"","form":"scalar","type":"double","value":"100"}'
t=table(1..2 as id,[x1,x2] as val)
typestr(fromJson(x1)) //DOUBLE
select id,fromJson(val) from t

执行最后一行语句时,提示

The data form is not supported

请问可以用什么方法解决?

请先 登录 后评论

1 个回答

logger

fromJson不能接受向量作为参数,可以用each函数来实现:

x1='{"name":"","form":"scalar","type":"double","value":"2.1E+5"}' 
x2='{"name":"","form":"scalar","type":"double","value":"100"}' 
t=table(1..2  as id,[x1,x2] as val)

select id,each(fromJson,val) from t
请先 登录 后评论