Filtering from JSON file

Hi there!

I am trying to work with a dataset that I pull from the web. It is open data coming from opendata.cbs.nl (CBS Dataportaal) .
Now I succeed in getting the JSON file into my TD project using a little bit of Python code with the requests library.

The JSON file I try to use lists data for every month since 1995 like so:

{
    "value": {
        "0": {
            "ID": 0,
            "Perioden": "1995MM01",
            "BevolkingAanHetBeginVanDePeriode_1": "15424122",
            "LevendGeborenKinderen_2": "   16436",
            "Overledenen_3": "   11974",
            "Immigratie_4": "    8362",
            "EmigratieInclusiefAdministratieveC_5": "    6768",
            "OverigeCorrecties_6": "",
            "TotaleBevolkingsgroei_7": "    6056",
            "BevolkingAanHetEindVanDePeriode_8": "15430178"
        },
        "1": {
            "ID": 1,
            "Perioden": "1995MM02",
             (and so on)

What I try to do is making a Base with custom parameters for Year and Month, so that you can select for example 2015 and January, and then see the data for that period. I feel like I just need a little hint towards getting there. Can someone help me out here?

Regards,

Bart

CBS_Bevolking_Data.2.toe (18.2 KB)

When you do a right-click on the jsonDAT you can open “Operator Snippets” to see many good examples how to use the operator. For example there is some filtering. Here are also some informations.

My personal two shots would be to either use the API for filtering using query-params (if available) and let the server do the heavy lifting. The backend has probably a database that is much more efficient with that kind of stuff.
The other solution would be to convert the data to a table (see snippets) and then use a selectDAT.

If you feel super fancy, you could also write a little script to basicly parse the data, feed it in to a local database/sqlite and then use sql-queries to fetch the data super efficient. But this is probably way overboard.

Sitenote:
Try to stay away from requests in TD, use the webClientDAT instead.
I also built a wrapper around it to make life easier: