{"action":"created","issue":{"url":"https://api.github.com/repos/wgenial/cartrolandofc/issues/22","repository_url":"https://api.github.com/repos/wgenial/cartrolandofc","labels_url":"https://api.github.com/repos/wgenial/cartrolandofc/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/wgenial/cartrolandofc/issues/22/comments","events_url":"https://api.github.com/repos/wgenial/cartrolandofc/issues/22/events","html_url":"https://github.com/wgenial/cartrolandofc/issues/22","id":162291162,"number":22,"title":"Cartola - Ajuda com correção de um Json","user":{"login":"nenzinho","id":20143489,"avatar_url":"https://avatars.githubusercontent.com/u/20143489?v=3","gravatar_id":"","url":"https://api.github.com/users/nenzinho","html_url":"https://github.com/nenzinho","followers_url":"https://api.github.com/users/nenzinho/followers","following_url":"https://api.github.com/users/nenzinho/following{/other_user}","gists_url":"https://api.github.com/users/nenzinho/gists{/gist_id}","starred_url":"https://api.github.com/users/nenzinho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nenzinho/subscriptions","organizations_url":"https://api.github.com/users/nenzinho/orgs","repos_url":"https://api.github.com/users/nenzinho/repos","events_url":"https://api.github.com/users/nenzinho/events{/privacy}","received_events_url":"https://api.github.com/users/nenzinho/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/wgenial/cartrolandofc/labels/duvida","name":"duvida","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-06-25T17:21:01Z","updated_at":"2016-06-25T17:36:37Z","closed_at":"2016-06-25T17:36:25Z","body":"Olá! Alguém pode me ajudar a corrigir um Json referente ao Cartola FC?\r\nPrimeiramente, segue o código:\r\n\r\n> <?php\r\n> $json_str = file_get_contents(\"https://api.cartolafc.globo.com/time/fuque-66\"); \r\n> $jsonObj = json_decode($json_str);\r\n> $atletas = $jsonObj->atletas;\r\n> foreach ( $atletas as $e )\r\n>     {\r\n> \techo \"$e->pontos_num - $e->apelido\"; \r\n>     }\r\n> ?> \r\n\r\nEsta função retorna todos os jogadores e suas respectivas pontuações:\r\n\r\n\r\n> 1.4 - Felipe Azevedo\r\n> 8.4 - Maicon\r\n> -0.3 - Ganso\r\n> 15.8 - Arrascaeta\r\n> 0 - Rodrigo Dourado\r\n> 0.82 - Argel Fucks\r\n> 18 - Alex Muralha\r\n> 7.4 - Vitor Bueno\r\n> 7.4 - Vitor Hugo\r\n> 1.6 - Bruno Rangel\r\n> 5.1 - Ernando\r\n> 3.3 - Róger Guedes\r\n\r\nAté aí tudo bem, consegui os pontos individuais de cada jogador. Depois disso, com o fim de somar estes valores para ter a pontuação total do time, acrescentei a função de soma da seguinte forma:\r\n\r\n> <?php\r\n> $json_str = file_get_contents(\"https://api.cartolafc.globo.com/time/fuque-66\"); \r\n> $jsonObj = json_decode($json_str);\r\n> $atletas = $jsonObj->atletas;\r\n> $v = 0.0;\r\n> foreach ( $atletas as $e )\r\n>     {\r\n> \techo \"$e->pontos_num - $e->apelido\"; \r\n>     echo $v += $e->pontos_num;\r\n>     }\r\n> ?> \r\n\r\nTrazendo o seguinte resultado:\r\n\r\n> 1.6 - Bruno Rangel\r\n> 1.67.4 - Vitor Hugo\r\n> 9-0.3 - Ganso\r\n> 8.75.1 - Ernando\r\n> 13.83.3 - Róger Guedes\r\n> 17.18.4 - Maicon\r\n> 25.51.4 - Felipe Azevedo\r\n> 26.90.82 - Argel Fucks\r\n> 27.7215.8 - Arrascaeta\r\n> 43.527.4 - Vitor Bueno\r\n> 50.9218 - Alex Muralha\r\n> 68.920 - Rodrigo Dourado\r\n> 68.92 \r\n\r\nComo se pode notar, a última linha consta o resultado exato da soma (68.92).\r\nContudo, as pontuações individuais ficaram embaralhadas (ex: 27.7215.8).\r\nComo posso consertar isso? Grato."},"comment":{"url":"https://api.github.com/repos/wgenial/cartrolandofc/issues/comments/228561259","html_url":"https://github.com/wgenial/cartrolandofc/issues/22#issuecomment-228561259","issue_url":"https://api.github.com/repos/wgenial/cartrolandofc/issues/22","id":228561259,"user":{"login":"giovanigenerali","id":41435,"avatar_url":"https://avatars.githubusercontent.com/u/41435?v=3","gravatar_id":"","url":"https://api.github.com/users/giovanigenerali","html_url":"https://github.com/giovanigenerali","followers_url":"https://api.github.com/users/giovanigenerali/followers","following_url":"https://api.github.com/users/giovanigenerali/following{/other_user}","gists_url":"https://api.github.com/users/giovanigenerali/gists{/gist_id}","starred_url":"https://api.github.com/users/giovanigenerali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giovanigenerali/subscriptions","organizations_url":"https://api.github.com/users/giovanigenerali/orgs","repos_url":"https://api.github.com/users/giovanigenerali/repos","events_url":"https://api.github.com/users/giovanigenerali/events{/privacy}","received_events_url":"https://api.github.com/users/giovanigenerali/received_events","type":"User","site_admin":false},"created_at":"2016-06-25T17:36:37Z","updated_at":"2016-06-25T17:36:37Z","body":"Blz @nenzinho!"}}
{"actor":{"display_login":"giovanigenerali"}}