Skip to content

Tag: grouping

Dynamically group flattened JSON into nested JSON object

Suppose I have the following JSON array: And would like to convert it into the following multidimensional object in JavaScript (no Lodash): I figure I can do it with a foreach, but I’m trying to do it using the reduce function (HOPING that is the right one to use here) and just not getting the right syntax. My current GUESS