I am trying to create an array structure like the initial one found here: D3 JSON data conversion
Mine would look something like the below, be dynamic, and then be passed to json_encode() to make a json object.
[
{ "name": "Table1", "lab": "name1", "cell": "c1", "avg": avgUsage1},
{ "name": "Table1", "lab": "name2", "cell": "c2", "avg": avgUsage2},
{ "name": "Table1", "lab": "name3", "cell": "c3", "avg": avgUsage3},
{ "name": "Table1", "lab": "name4", "cell": "c4", "avg": avgUsage4},
{ "name": "Table1", "lab": "name5", "cell": "c5", "avg": avgUsage5} ...
]
The problem is that I cannot have an array that has the same values for the key. What is this data structure and how can I create something like it to then create a nested structure (I will follow the linked post to create the nested structure)?