生成json时,要用Tostring来转成字符型,若是逻辑字段,用Tostring就变成字符True/False了,返回前端后,对于checkbox就不能直接用checked属性绑定对应字段了
Dim ygarr As new JArray
Dim drs As List(of DataRow) = dt.Select(True)
For i As Integer = 0 To drs.Count -1
ygarr.add(new JObject)
ygarr(i)("kind") = drs(i)("类别").Tostring
ygarr(i)("prono") = drs(i)("编号").Tostring
ygarr(i)("price") = drs(i)("销售价").Tostring
ygarr(i)("count") = drs(i)("数量").Tostring
ygarr(i)("checked") = drs(i)("选中").Tostring
next
例如上面代码,选中是个逻辑字段,应该怎么处理,才能转为json时也是个逻辑的true/false值?