Read Json with no tag name

asked 2020-06-11 06:37:15 -0500

Ghanshyam gravatar image

updated 2020-06-12 15:03:05 -0500

iamontheinet gravatar image

i am having a nested json: Input json:

 {
        "std1": {
            "0:65263:32": {
                "StdDev": 0.0,
                "Mean": 261.99,
                "Max": "261.9921875",
                "Values": [{
                        "ts": 1542977703859,
                        "value": 261.9921875
                    },
                    {
                        "ts": 1542977704859,
                        "value": 261.9921875
                    }
                ],
                "Sa": 0,
                "Units": "kPa",
                "Date": "2018-11-23 12:55:03",
                "Variance": 0.0,
                "Name": "Crankcase Pressure"
            },
            "61:65443:16": {
                "StdDev": 0.0,
                "Mean": 65535.0,
                "Max": "65535.0",
                "Values": [{
                        "ts": 1542977704169,
                        "value": 65535.0
                    },
                    {
                        "ts": 1542977705169,
                        "value": 65535.0
                    }
                ],
                "Sa": 61,
                "Units": "mbar",
                "Date": "2018-11-23 12:55:04",
                "Variance": 0.0,
                "Name": "DEF Air Pressure"
            }
        }
    }

i want to read the value tag, i could use a field pivot but here immediate tag after std is dynamic. how to render that in field pivoter if not is there any other way to parse this

Desired output: Push units,date,ts and value into a csv

edit retag flag offensive close merge delete

Comments

Can you update your question and provide expected/desired output. It's not clear what you're trying to accomplish.

iamontheinet gravatar imageiamontheinet ( 2020-06-11 17:22:59 -0500 )edit

So "units" and "date" values will repeated in the output/csv for the two values of "ts" and "values" since "Values" is a list?

iamontheinet gravatar imageiamontheinet ( 2020-06-12 15:06:01 -0500 )edit

yes, you got it right.

Ghanshyam gravatar imageGhanshyam ( 2020-06-15 06:23:52 -0500 )edit