In a MapBox Studio project of mine, I have field values that are stored as JSON values. My features all have attributes like:

id 48545756
meta {}
relations []
tags {"access":"forestry","highway":"track","source":"WRI;DIAF","start_date":"before2013-03-28"}
type way

I'm trying to filter by a key in the tags field. Something like:

#layer['tags.access' = 'forestry']{ ... }
#layer['tags' = '{"access": "forestry"}']{ ... }

But of course MapBox Studio interprets the JSON as a string, not something that can be parsed.

Any thoughts on how to get around this?

Why JSON as feature attribute values? MapBox's uploads api provides a really good way to programmatically upload data to a MapBox account. If you send a geojson file (rather than a mbtiles file), MapBox tiles it out with it's attributes as a json value in the 'tags' field.

1 Answer 1


Figured it out. While it doesn't look like it's possible to actually parse the json, MapBox Studio supports regular expressions in filters:

#original {
  line-color: #F8842E;
  line-width: 0.8;
  [tags =~ '.*"access":"forestry".*']{
    line-width: 1.4;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.