Skip to main content

Datatransformation

A key feature of the kortxyz-datastore component is support for JSONata expressions — a concise query and transformation language for JSON — enabling powerful filtering, shaping, and computed fields in datastore workflows.

kortxyz-datastore accepts JSON data as its input — either from a remote URL or provided inline. So the property transform is the expression to take the input JSON and turn it into geojson features. So every data API which delivers geospatial data can be used by the kortxyz-webcomponent, if it is transform into a array of geojson features.

<kortxyz-datastore 
  store="afstemningssted"
  data="https://api.dataforsyningen.dk/afstemningsomraader?kommunekode=183"
  transform='*.{
        "id":$number(dagi_id),
        "type": "Feature",
        "properties": {
            "navn": afstemningssted.navn,
            "adresse": afstemningssted.adgangsadresse.adressebetegnelse
        },
        "geometry": {
            "type": "Point",
            "coordinates": afstemningssted.adgangsadresse.koordinater
        }
   }'
  ></kortxyz-datastore>

Another usage is to filter from data from a API that does not have that capability.

  <kortxyz-datastore 
    store="buildings" 
    data="https://example.com/buildings"
    query="$.features[?(@.properties.status != 'Finished')]"
></kortxyz-datastore>

To play around with JSONata playground is a good place.

Updated on Jan 8, 2026