[Development] [RFO QTBUG-84739] QJsonValue::fromVariant containing QByteArray
Tor Arne Vestbø
Tor.arne.Vestbo at qt.io
Fri Jul 3 02:56:39 CEST 2020
> On 3 Jul 2020, at 02:49, Thiago Macieira <thiago.macieira at intel.com> wrote:
>
> On Thursday, 2 July 2020 15:46:24 PDT Tor Arne Vestbø wrote:
>> I think I prefer permanently, and then clearly documenting that the fallback
>> conversion to a string for non-listed types may be lossy, teaching the user
>> to either encode the data into one of the well defined and non-lossy types
>> (e.g. use a QString if what you're representing is a string, or
>> base64-encode raw binary data), or use CBOR instead.
>
>> That leaves less amount of surprises when upgrading to Qt 6 while being
>> clear about the possible downsides.
>
> Thank you.
>
> For Qt 6, I think we should look at the list of meta types and explicitly list
> how they are converted to CBOR and JSON, so for QByteArray it would be clear
> that it's a lossy conversion using fromUtf8. Any type not in the white list
> gets converted to JSON null or CBOR undefined but subject to change.
>
> And unit-test them.
That sounds like a great way forward. Thank you Thiago!
Cheers,
Tor Arne
More information about the Development
mailing list