Showing json text in atrribute widgets

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Showing json text in atrribute widgets

Bo Victor Thomsen
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 ?

--

Med venlig hilsen / Kind regards

Bo Victor Thomsen

_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: Showing json text in atrribute widgets

Matthias Kuhn 🌍
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 ?
>
_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: Showing json text in atrribute widgets

Bo Victor Thomsen
Thanks Matthias -

I was not aware that GeoPackage could handle json data. It works nicely
now after I have redefined the fields from text to json-text

Shall I open a ticket in GitHub about the missing option for creating
json-text fields in the create layer dialog for geopackage ?

--
Med venlig hilsen / Kind regards

Bo Victor Thomsen

Den 08-12-2019 kl. 08:58 skrev Matthias Kuhn:

> 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 ?
>>
> _______________________________________________
> Qgis-user mailing list
> [hidden email]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: Showing json text in atrribute widgets

Matthias Kuhn 🌍
Hi Bo,

Glad to hear it works.

Yes, please open a ticket!

Best regards

Matthias

On 12/8/19 7:16 PM, Bo Victor Thomsen wrote:
> Thanks Matthias -
>
> I was not aware that GeoPackage could handle json data. It works
> nicely now after I have redefined the fields from text to json-text
>
> Shall I open a ticket in GitHub about the missing option for creating
> json-text fields in the create layer dialog for geopackage ?
>
_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user