Hello I have something like this from a json_encode () in PHP
["texto1.","texto2","texto3"]
and I want to get something like this
"cast": [
{
"name": "texto1"
},
{
"name": "texto2"
},
{
"name": "texto3"
}
]
This is the PHP code I have:
<?php
$json2 = file_get_contents('http://pastebin.com/raw/au4ds3bQ');
$get2 = json_decode($json2);
$a = "1";
$a2 = $get2->data->$a->cast;
echo json_encode($a2);
?>