I have the following array, with thoushand json elements, like the following
[ { "id": 302,"hostname": "laptop857","total_memory": 31722,"total_swap": 92535,"distribution": "22.04","hardware": [ ["product","XPS 15 7590 (0905)", null ], ["vendor","Dell Inc.", null ], ["serial","XXDPXXX", null ] ] } {"id": 303,"hostname": "laptop858", .... }, ]
My goal is to parse the json file and for each elements extract the hostname, distribution and serial number. I want to create a report where each line represent a computer, likelaptop857,22.04,XXDPXXXlaptop858, ....
I'm able to output for hostname and distribution , togetherI'm also able to do it for serial, but some entries do not have serial number and failed the parsingI keep getting error for whatever I try to get the 3 elements together on the same line
Any chance someone could provide hit or what I should look at to achieve my resultI could live with an entry likelaptop857,22.04,serial XXDPXXX null