[Qgis-user] Showing json text in atrribute widgets

Matthias Kuhn matthias at opengis.ch
Sat Dec 7 23:58:42 PST 2019


Hi Bo,

GeoPackage has support for JSON fields, meaning that text fields can be 
of JSON type.

When you add a new JSON field (e.g via the field calculator) this type 
can be chosen and then the key/value widget should work.

I just realized, that the JSON field type is missing from the create new 
geopackage layer dialog.

Matthias


On 12/7/19 7:08 PM, Bo Victor Thomsen wrote:
> Hi list -
>
> I'm trying to create a attribute form that would show  json key/value 
> pairs in an attribute form. The json data is stored in a text field 
> like this : '{ "one":"1", "two":"2",... }'. The dataaprovider is a 
> GeoPackage
>
> I would like to show the json text field using a key/value widget. 
> However this option is always greyed out and can't be activated for 
> the text field.
>
> I've tried creating a virtual field (type blob) where the value in the 
> virtual field was populated using a expression like: from_json 
> ("my_json_text_field") and other similar methods. However the 
> key/value widtget is always greyed out.
>
> I'm aware, that I could create a Postgres database and put my data in 
> postgres table and getting it to work. However, that's not an option 
> in this case.
>
> Is there a solution to this problem ?
>


More information about the Qgis-user mailing list