[QGIS-Developer] How to force 'json(tree)' widget in feature info panel
Richard Duivenvoorde
rdmailings at duif.net
Thu Dec 5 13:15:45 PST 2024
Hi Devs,
Working with an api which returns json, we thought to make it possible to see the returned (small) json documents as a json tree widget (like you for example can see in a SensorThingsApi identify result, see screendump).
So creating a memory layer using and setting the providers attributes using a QgsField like:
QgsField(name="json", type=QMetaType.QVariantMap, typeName='json', len=0, prec=0, comment="", subType=QMetaType.QString)])
(for which I stole type and subtype en typename from a layer which was showing the json widget...)
But in the featureinfo result the 'json'-field keeps being show as a plain string.
Am I missing some detail? Or magic?
Or is this something not possible with Memory Layers?
Any hint is appreciated.
Regards,
Richard Duivenvoorde
PS recently I was also asked by somebody if there was a plugin or widget which was able to show the result of an rest/json api call (upon clicking on a feature) in some kind of treeview (like Postman or even browsers) too...
I think some standard way of talking to simple api's from within QGIS would be a good thing to have..
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot From 2024-12-05 22-07-00.png
Type: image/png
Size: 29035 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20241205/8f9f8b92/attachment-0001.png>
More information about the QGIS-Developer
mailing list