JSON expansion in Power Query M
✓ Published0🌍 Public
HHugoberry
Last edited Feb 22, 2017
Created on Feb 22, 2017
This example demonstrates how to flatten or expand nested JSON structures using Power Query’s M language, specifically through the `List.Generate` function. It shows the step-by-step traversal of a record hierarchy, where each iteration checks whether the current value is a record, tracks the nesting level, and builds an output record that appends the field names discovered at each depth. The code relies on core M functions like `Record.FieldNames`, `Record.FieldValues`, and `Record.AddField`, along with list concatenation, to construct the expanded output. The visualization highlights a programmatic approach to transforming hierarchical JSON into a flat, tabular-friendly format, without external libraries.
AI-generated description