[QGIS-Developer] How to encode blobs in (Geo)JSON?

Even Rouault even.rouault at spatialys.com
Thu Nov 7 09:36:00 PST 2019


On jeudi 7 novembre 2019 17:40:08 CET Alessandro Pasotti wrote:
> Hi,
> 
> I'm running into an issue with OAPIF and blob/binary fields, the
> QgsJsonExporter does not currently handle that kind of field and just
> convert them to string (whatever that means).
> 
> This is clearly wrong in case the blob does not contain ascii or UTF-8, I
> think the way to go might be to base64 the blob but I'd like to know if
> anyone has a better idea.

Initially, I was going to suggest perhaps to wrap it inside an object with an 
explicit base64 member

like:

"my_binary_property": {
	"base64": "...."
}

But after looking at
https://json-schema.org/latest/json-schema-validation.html#rfc.section.8.3
https://json-schema.org/latest/json-schema-validation.html#rfc.section.8.6

perhaps just putting it at top level ( "my_binary_property": 
"base64contenthere" } is fine as you can tag this string property with 
"contentEncoding": "base64"

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the QGIS-Developer mailing list