that's not an array, that's a string.
And another problem is, that it's not even valid json nor valid php code.
you have to fix this first.
But the much better solution is to figure out were that string comes from, because it obviously was an array before you probably called var_dump
on it.
you probably want this:
$dataArray = array (
0 =>
array (
'Field Val' =>'val1',
'Field Val2' =>'val2',
),
1 =>
array (
'Field Val' =>'val1',
'Field Val2' =>'val2'
)
);
valid php as string
you have to eval()
to create the code in your string. and then you have an array.
If you would work with strings in json notation this would be the preffered way:
you can use $dataArray = json_decode($dataArray, true);
to convert it to an actual array.
The much cleaner way is to inject \Magento\Framework\Serialize\Serializer\Json
and use serialize($data)