If you create a variant array and use GenerateJSON on it, you will get an array of strings regardless of the types of the individual elements. This is especially problematic with booleans where they will be generated as [“True”] instead of [true].
Whether it’s a change or not, it’s wrong. If you ParseJSON( “[1,2,3]”), you get a variant array of integers. You should be able to use GenerateJSON to reverse that, but currently can’t.
Note I NEVER said it wasnt a bug
I asked if it was ok before and not now because that could be relevant if it was correct in R2/2.1 and isnt now
In 2019r1.1 this gets the right thing
Dim v() As Auto
v.append True
v.append 123
v.append False
v.append "hello world"
Dim t As Text = Xojo.Data.GenerateJSON(v)
Break
the roughly equivalent in R3
Dim v() As Variant
v.append True
v.append 123
v.append False
v.append "hello world"
Dim s As String = GenerateJSON(v)
Break
doesnt
but the same Xojo framework code in r3 generates the exact same result as it does in R1
whatever GenerateJSON is based on is doing something really wrong
Ironic that I have a method that converts a RecordSet to json…When I changed to a RowSet, I got json with all strings and I thought it was GenerateJSON that had changed. It turned out to be DatabaseColumn.Value in API2 changed and now return Strings…always. Yes, variants are evil. But so handy. I hope DatabaseColumn.Value will be fixed and not left this way.