<?php
$arr_json = '{
"contra_cheques":{
"1731793":[
{
"periodo":"012018",
"0":"012018",
"titulo":"Janeiro\/2018",
"1":"Janeiro\/2018"
},
{
"periodo":"122017",
"0":"122017",
"titulo":"Dezembro\/2017",
"1":"Dezembro\/2017"
},
{
"periodo":"112017",
"0":"112017",
"titulo":"Novembro\/2017",
"1":"Novembro\/2017"
},
{
"periodo":"102017",
"0":"102017",
"titulo":"Outubro\/2017",
"1":"Outubro\/2017"
},
{
"periodo":"092017",
"0":"092017",
"titulo":"Setembro\/2017",
"1":"Setembro\/2017"
},
{
"periodo":"082017",
"0":"082017",
"titulo":"Agosto\/2017",
"1":"Agosto\/2017"
},
{
"periodo":"072017",
"0":"072017",
"titulo":"Julho\/2017",
"1":"Julho\/2017"
},
{
"periodo":"062017",
"0":"062017",
"titulo":"Junho\/2017",
"1":"Junho\/2017"
}
]
}
}';
$rs = [];
foreach($arr as $cc){
$pps = [];
$srs = [];
foreach($cc as $pp){
foreach($pp as $pps){
$srs[] = [
'id' => $pps['periodo'],
'titulo' => $pps['titulo'],
];
}
}
'periodo'=>$srs
];
}
PD9waHAKJGFycl9qc29uID0gJ3sKICAgImNvbnRyYV9jaGVxdWVzIjp7CiAgICAgICIxNzMxNzkzIjpbCiAgICAgICAgIHsKICAgICAgICAgICAgInBlcmlvZG8iOiIwMTIwMTgiLAogICAgICAgICAgICAiMCI6IjAxMjAxOCIsCiAgICAgICAgICAgICJ0aXR1bG8iOiJKYW5laXJvXC8yMDE4IiwKICAgICAgICAgICAgIjEiOiJKYW5laXJvXC8yMDE4IgogICAgICAgICB9LAogICAgICAgICB7CiAgICAgICAgICAgICJwZXJpb2RvIjoiMTIyMDE3IiwKICAgICAgICAgICAgIjAiOiIxMjIwMTciLAogICAgICAgICAgICAidGl0dWxvIjoiRGV6ZW1icm9cLzIwMTciLAogICAgICAgICAgICAiMSI6IkRlemVtYnJvXC8yMDE3IgogICAgICAgICB9LAogICAgICAgICB7CiAgICAgICAgICAgICJwZXJpb2RvIjoiMTEyMDE3IiwKICAgICAgICAgICAgIjAiOiIxMTIwMTciLAogICAgICAgICAgICAidGl0dWxvIjoiTm92ZW1icm9cLzIwMTciLAogICAgICAgICAgICAiMSI6Ik5vdmVtYnJvXC8yMDE3IgogICAgICAgICB9LAogICAgICAgICB7CiAgICAgICAgICAgICJwZXJpb2RvIjoiMTAyMDE3IiwKICAgICAgICAgICAgIjAiOiIxMDIwMTciLAogICAgICAgICAgICAidGl0dWxvIjoiT3V0dWJyb1wvMjAxNyIsCiAgICAgICAgICAgICIxIjoiT3V0dWJyb1wvMjAxNyIKICAgICAgICAgfSwKICAgICAgICAgewogICAgICAgICAgICAicGVyaW9kbyI6IjA5MjAxNyIsCiAgICAgICAgICAgICIwIjoiMDkyMDE3IiwKICAgICAgICAgICAgInRpdHVsbyI6IlNldGVtYnJvXC8yMDE3IiwKICAgICAgICAgICAgIjEiOiJTZXRlbWJyb1wvMjAxNyIKICAgICAgICAgfSwKICAgICAgICAgewogICAgICAgICAgICAicGVyaW9kbyI6IjA4MjAxNyIsCiAgICAgICAgICAgICIwIjoiMDgyMDE3IiwKICAgICAgICAgICAgInRpdHVsbyI6IkFnb3N0b1wvMjAxNyIsCiAgICAgICAgICAgICIxIjoiQWdvc3RvXC8yMDE3IgogICAgICAgICB9LAogICAgICAgICB7CiAgICAgICAgICAgICJwZXJpb2RvIjoiMDcyMDE3IiwKICAgICAgICAgICAgIjAiOiIwNzIwMTciLAogICAgICAgICAgICAidGl0dWxvIjoiSnVsaG9cLzIwMTciLAogICAgICAgICAgICAiMSI6Ikp1bGhvXC8yMDE3IgogICAgICAgICB9LAogICAgICAgICB7CiAgICAgICAgICAgICJwZXJpb2RvIjoiMDYyMDE3IiwKICAgICAgICAgICAgIjAiOiIwNjIwMTciLAogICAgICAgICAgICAidGl0dWxvIjoiSnVuaG9cLzIwMTciLAogICAgICAgICAgICAiMSI6Ikp1bmhvXC8yMDE3IgogICAgICAgICB9CiAgICAgIF0KICAgfQp9JzsKCiRhcnIgPSBqc29uX2RlY29kZSgkYXJyX2pzb24sdHJ1ZSk7CiRycyA9IFtdOwpmb3JlYWNoKCRhcnIgYXMgJGNjKXsKCSRwcHMgPSBbXTsKCSRzcnMgPSBbXTsKCWZvcmVhY2goJGNjIGFzICRwcCl7CgkJCgkJZm9yZWFjaCgkcHAgYXMgJHBwcyl7CgkJCQoJCSRzcnNbXSA9IFsKCQkJJ2lkJyA9PiAkcHBzWydwZXJpb2RvJ10sCgkJCSd0aXR1bG8nID0+ICRwcHNbJ3RpdHVsbyddLAoJCQldOwoJCX0KCX0KCQoJJHJzW2tleSgkY2MpXT0gWwoJCSdwZXJpb2RvJz0+JHNycwoJCV07Cn0KCXByaW50X3IoJHJzKTs=