Wildcard JSON Extraction in Alloy: Possible?

Looking for a way in Grafana Alloy to automatically extract all fields from a JSON log without listing every attribute in the config. Right now, I have to specify each field with the expressions option in stage.json, like this:

stage.json {
expressions = {
datetime = “time”,
log_level = “level”,
msg = “msg”,
component = “component”,
// …must add every key
}
}

Is there a wildcard or one-line syntax to grab all JSON fields automatically?

example log:
{"time":"2025-10-11T01:00:00Z","level":"info","msg":"example log","component":"dataset","source":"infra"}

I don’t think so, but is there a reason you might want to do this?

You don’t need to parse json unless you intend to use the key or value somewhere in your log pipeline, and you should hopefully rarely have to do that, if ever. It would be much easier to perform minimal parsing, and extract JSON at query time.

No, wildcard JSON extraction isn’t directly supported in Alloy. You must specify exact JSON paths or use scripting logic to loop through keys dynamically.