Transforming an uneven JSON

I have a JSON like the one shown below

{
    "timestamps": [
        "2020-12-17T20:05:00Z",
        "2020-12-17T20:10:00Z",
        "2020-12-17T20:15:00Z",
        "2020-12-17T20:20:00Z",
        "2020-12-17T20:25:00Z",
        "2020-12-17T20:30:00Z"
    ],
    "properties": [
        {
            "values": [
                -20.58975828559592,
                -19.356728999226693,
                -19.808982964173023,
                -19.673928070777993,
                -19.712275037138411,
                -19.48422739982918
            ],
            "name": "Neg Flow",
            "type": "Double"
        },
        {
            "values": [
                2,
                20,
                19,
                20,
                19,
                16
            ],
            "name": "Event Count",
            "type": "Long"
        }
    ],
    "progress": 100.0
}

How to convert this to a data frame like the following . Though I was able to loop thorough the individual data items, I am interested in finding if there is a sleek way to do this?

+----------------------+---------------------+-------------+
+Time Stamps           + Neg Flow            + Event Count +
+----------------------+---------------------+-------------+
|2020-12-17T20:05:00Z  |-20.58975828559592   | 2           |
+----------------------+---------------------+-------------+
|2020-12-17T20:10:00Z  |-19.356728999226693  | 20          |
+----------------------+---------------------+-------------+
library(jsonlite)

data.frame(fromJSON("/home/roc/projects/mar/my.json"))
#> Warning in (function (..., row.names = NULL, check.rows = FALSE, check.names =
#> TRUE, : row names were found from a short variable and have been discarded
#>             timestamps
#> 1 2020-12-17T20:05:00Z
#> 2 2020-12-17T20:10:00Z
#> 3 2020-12-17T20:15:00Z
#> 4 2020-12-17T20:20:00Z
#> 5 2020-12-17T20:25:00Z
#> 6 2020-12-17T20:30:00Z
#>                                                  properties.values
#> 1 -20.58976, -19.35673, -19.80898, -19.67393, -19.71228, -19.48423
#> 2                                            2, 20, 19, 20, 19, 16
#> 3 -20.58976, -19.35673, -19.80898, -19.67393, -19.71228, -19.48423
#> 4                                            2, 20, 19, 20, 19, 16
#> 5 -20.58976, -19.35673, -19.80898, -19.67393, -19.71228, -19.48423
#> 6                                            2, 20, 19, 20, 19, 16
#>   properties.name properties.type progress
#> 1        Neg Flow          Double      100
#> 2     Event Count            Long      100
#> 3        Neg Flow          Double      100
#> 4     Event Count            Long      100
#> 5        Neg Flow          Double      100
#> 6     Event Count            Long      100

Created on 2021-01-17 by the reprex package (v0.3.0.9001)

@technocrat: Thank you ! but its not the format I was looking for. Please look at table in my question. Thats the format I was looking for!

Then rearrange or supplement the data frame.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.