GenerateJSON( variantArr ) does not work properly

See <https://xojo.com/issue/58940>.

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].

variants are evil anyway

Variants might be evil but Kem’s case is still a bug.

I agree esp if its a change from prior versions

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.

#new minivan :slight_smile:

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

Aaaand fixed.

the advantages of a pro+ license huh ?

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.

great and
arrrg
i just installed r3.1 because database

mvp premium customer :slight_smile:

the next bug i forward to the top 5 :wink:

I wish all my reports were handled with such expediency.