I have a syntax (in php) to generate the Json file. But I need this syntax to be created dynamically, that is, according to the result of another class.
You're like this:
Given the values of a Matrix
Coluna 1 - Coluna 2
190 340
190 54
Given that, the data in column 1 are the parents of the data in column 2. At line zero the value (190) is being the parent of the value (340), and so on.
Given these values, the syntax would look like this:
$name = "name";
$children = "children";
$valor1 = "190";
$valor2 = "340";
$var = array ($name=>"$valor1",$children=>array(array($name=>"$valor2"),array($name=>"$ip1")));
$ip = json_encode($var, JSON_PRETTY_PRINT);
I need the syntax, which is entering the variable $ var. Be created by myself according to my matrix, with the amount of values it has.
Because the array can (and will) have more rows.