Extract data from a column

Hi,
i have a table and a column "other_tags" with data like this
"addr:city"=>"Greven","addr:housenumber"=>"25","addr:postcode"=>"48268","addr:street"=>"Rathausstraße","amenity"=>"pub"
how can i create new columns like "address", "city" etc that show only "addr:city", "addr:street", etc from other_tags?
thanks!

  1. Add a new column (the plus button above the columns list).
  2. Set the Source to your "other_tags" field.
  3. Set the value to some code that will extract the address or city from your data. {{item}} would represent the entire value of "other_tags" and you would extract what you needed from it. What you use here totally depends on how "other_tags" is formatted.

I can't tell what your data is actually formatted like, are you using => as a delimiter within a string? If so I guess you would do something like {{item.split('=>')[0].split(":")[1]}} to get the first value (city in tour example) and {{item.split('=>')[1].split(":")[1]}} to get housenumber and so on.

If it were just JSON you would do {{item['addr:city']}}

1 Like