don't quote cells that look like json objects themselves

This commit is contained in:
Paul Trowbridge 2018-10-11 14:24:59 -04:00
parent 81e7bd3f07
commit f546f7c7d1

View File

@ -2073,7 +2073,12 @@ Public Function json_from_table(ByRef tbl() As Variant, ByRef array_label As Str
If IsNumeric(tbl(r, c)) And Mid(tbl(r, c), 1, 1) <> 0 Then
json = json & Chr(34) & tbl(1, c) & Chr(34) & ":" & tbl(r, c)
Else
json = json & Chr(34) & tbl(1, c) & Chr(34) & ":" & Chr(34) & tbl(r, c) & Chr(34)
'test if item is a json object
If Mid(tbl(r, c), 1, 1) = "{" Or Mid(tbl(r, c), 1, 1) = "[" Then
json = json & """" & tbl(1, c) & """" & ":" & tbl(r, c)
Else
json = json & Chr(34) & tbl(1, c) & Chr(34) & ":" & Chr(34) & tbl(r, c) & Chr(34)
End If
End If
End If
Next c