응답 :
{
"report":{
"type":"ranked",
"elements":[
{
"id":"browser",
"name":"Browser"
},
{
"id":"operatingSystem",
"name":"Operating System"
}
],
"reportSuite":{
"id":"xyz",
"name":"xyz | .com"
},
"period":"October 2015",
"metrics":[
{
"id":"revenue",
"name":"Revenue",
"type":"currency",
"decimals":2,
"latency":xxxx,
"current":false
}
],
"data":[
{
"name":"Google Chrome 45.0",
"url":"",
"counts":[
"450000.41"
],
"breakdown":[
{
"name":"Windows 7",
"url":"",
"counts":[
"20000.00"
]
},
{
"name":"OS X 10.10",
"url":"",
"counts":[
"35000.00"
]
},
{
"name":"Windows 8.1",
"url":"",
"counts":[
"50000.00"
]
},
{
"name":"Windows 10",
"url":"",
"counts":[
"37000.20"
]
},
{
"name":"OS X 10.9.5",
"url":"",
"counts":[
"19000.25"
]
},
{
"name":"Windows Vista",
"url":"",
"counts":[
"20000"
]
}
]
}
]
}
],
"totals":[
"27217371.38"
],
"version":"1.4.15.11"
},
"waitSeconds":"1.390",
"runSeconds":"5.021"
}
카운트를 기반으로 각 OS의 전체 백분율을 계산하는 방법을 묻는다고 가정합니다. 알고리즘은 간단합니다. 각 개체의 총 개수를 집계 한 다음 주어진 개체에 대해 개수 / 총 개수 * 100을 나눕니다.
실제 JSON 데이터를 구문 분석하는 데 도움이 필요한 경우 여기에 대한 좋은 질문 / 답변이 있습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다