don't quote cells that look like json objects themselves
This commit is contained in:
parent
81e7bd3f07
commit
f546f7c7d1
@ -2072,10 +2072,15 @@ Public Function json_from_table(ByRef tbl() As Variant, ByRef array_label As Str
|
|||||||
needs_comma = True
|
needs_comma = True
|
||||||
If IsNumeric(tbl(r, c)) And Mid(tbl(r, c), 1, 1) <> 0 Then
|
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)
|
json = json & Chr(34) & tbl(1, c) & Chr(34) & ":" & tbl(r, c)
|
||||||
|
Else
|
||||||
|
'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
|
Else
|
||||||
json = json & Chr(34) & tbl(1, c) & Chr(34) & ":" & Chr(34) & tbl(r, c) & Chr(34)
|
json = json & Chr(34) & tbl(1, c) & Chr(34) & ":" & Chr(34) & tbl(r, c) & Chr(34)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
Next c
|
Next c
|
||||||
If needs_braces > 0 Then json = "{" & json & "}"
|
If needs_braces > 0 Then json = "{" & json & "}"
|
||||||
needs_comma = False
|
needs_comma = False
|
||||||
|
Loading…
Reference in New Issue
Block a user