Question

JSON Array to table

  • 22 March 2022
  • 4 replies
  • 120 views

hi,

I have the following json time series and would like to convert it to a table structure.

so per time and value an own row with all station information.

Unfortunately I can't find a corresponding example in the FME help.

 

[
    {
        "ts_id": "19690010",
        "station_name": "Badinghagen W",
        "station_latitude": "51.084693593981505",
        "station_longitude": "7.650786142144193",
        "parametertype_name": "Niederschlagshöhe (N)",
        "ts_name": "Tag.Summe",
        "ts_unitname": "Millimeter",
        "ts_unitsymbol": "mm",
        "station_no": "13100039",
        "station_id": "12918",
        "rows": "4",
        "columns": "Timestamp,Value",
        "data": [
            [
                "2022-03-18",
                0.03
            ],
            [
                "2022-03-19",
                0.00
            ],
            [
                "2022-03-20",
                0.00
            ],
            [
                "2022-03-21",
                0.00
            ]
        ]
    }
]

 

planned result:image 

Maybe you have a solution.

thank you


4 replies

Userlevel 4
Badge +30

Hi @torstenschramm​ 

 

Did you try the transformer JSONFragmenter?

 

I tried here with your json file:

 

Json_Attributes 

 

Thanks in Advance,

Danilo

Thanks for the tip.

I already get a result that goes in the right direction.

But how do I get the measured value behind the date ?

FME Kopie

Badge +2

Thanks for the tip.

I already get a result that goes in the right direction.

But how do I get the measured value behind the date ?

FME Kopie

Hi @torstenschramm​ ,

Here are two ways you can get to your desired output. 1) Fragment the outermost JSON element and then explode the data list or 2) fragment the outermost JSON element then fragment the data array. Both options are essentially the same (one is just handled as an FME list where the other is handled as a JSON array but the output is the same). See attached and let me know if that helps2022-03-22_9-28-31I'm not a JSON pro so there may be a more efficient way

Thanks for the help and patience with a FME beginner. Now it works as expected :-))

Reply