I have a json string that I’m working with (just for learning purposes at the moment). Ive pulled in data from YouTube’s API and want to display 16000000 as 16.0M. This is what I have, but obviously it’s not the correct format I’m looking for.
{## Imitate available variables: ##}
{% set value_json = {
"kind": "youtube#channelListResponse",
"etag": "apfia4blXOrLYhFJeAz1bhfPFu4",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#channel",
"etag": "qei19gKsV47obGcRHna7K8Rq2JQ",
"id": "UCBJycsmduvYEL83R_U4JriQ",
"statistics": {
"viewCount": "3102295352",
"subscriberCount": "16000000",
"hiddenSubscriberCount": false,
"videoCount": "1458"
}
}
]
} %}
{{ value_json["items"][0].statistics.subscriberCount | int / 100000 | round(2) }}