A job named 'prepare' writes a JSON array of OS names to an output called 'os-list'. Which strategy block correctly builds a matrix from that output?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Job outputs are always strings. fromJSON() turns a JSON array string into a real array the matrix can expand — without it the matrix treats the whole string as one value.
Full explanation below image
Full Explanation
GitHub Actions job outputs are passed as strings even when the content looks like JSON. A matrix axis needs an actual array (or map), so you must parse the string with fromJSON(). The correct pattern is strategy.matrix.os: ${{ fromJSON(needs.prepare.outputs.os-list) }} after the prepare job sets that output (typically by writing to $GITHUB_OUTPUT). Using the raw output without fromJSON leaves a single string element. toJSON() does the opposite — it serializes an object to a string, which is useless for building a matrix. include expects a list of combination objects, not a bare OS array string. Dynamic matrices are a common GH-200 topic: generate the list in one job, consume it with fromJSON in the next.