天软金融分析.NET函数大全
>
TSL函数
>
基础函数
>
字符串
>
多语言支持函数
Importjsonstring
复制链接
简述
将json串转化为天软数据类型。
对大无符号数据会自动转换为长整型(INT64)
注意:输入的字符串应是ASCII编码的。因为JSON标准使用UTF8编码,所以请先使用天软Utf8ToAnsi将UTF8编码的字符串缓缓为ASCII编码。可参考下面的例程。
定义
Importjsonstring (json:String): Any;
参数
名称
类型
说明
json
String
字符串,json串。
返回
Any
任意数据类型。
范例
范例01:将json串转换成天软字符串
json:=%%g "\u4E07 \u79D1\uFF21"%%g;
//注:在上述语句中,原串存在转义字符,需要用到非转义字符串%%表示该字符串,不能用引号进行表示。
return importjsonstring(json);
//返回字符串:万 科A
范例02:将exportjsonstring转化的json串转为天软数据结构
s:=array((1,'a'),('Tinysoft天软','天软科技'));
json:= exportjsonstring(s);
return importjsonstring(json);
//返回
0
1
1
a
Tinysoft天软
天软科技
范例03:
arr := array(("code": "PFTSDEMO0004", "name":"商品跨期"),
("代码":"PFTSDEMO0003", "name":"债券组合")) ;
return importJsonString(Utf8toAnsi(exportJsonStringUTF8(arr)));
//返回
code
name
代码
PFTSDEMO0004
商品跨期
债券组合
PFTSDEMO0003
范例04:将大的无符号数字转为int64
json:=%%g 4611686018427387904 %%g;
return importjsonstring(json);
相关
AnsiPos
ByteType
ByteToCharLen
CharToByteLen
ByteToCharIndex
CharToByteIndex
CharLength
NextCharIndex
AnsiQuotedStr
AnsiDequotedStr
AnsiToUTF8
UTF8ToAnsi
UnicodeESC
unUnicodeESC
MultibyteToUnicode
UnicodeToMultiByte
LCMapString
MakeLCID
unUnicodeESC2
unUnicodeESC2w
UnicodeESC2
unUnicodeESCw
Strw
CurrtoStrw
FloattoStrw
MultibytetoUnicodew
UnicodetoUTF8
UTF8toUnicode
Inttohexw
Inttostrw
Ifwstring
Booltostrw2
Booltostrw
Exportjsonstring
Importjsonstring
ExportJsonStringUTF8
ExportJSONStringMBCS