Transform csv data in a json to a table

I call an api and as response I get json data, now this json contains csv data that I need to convert into a table. I am not able to come up with a solution to this.

Example of data:

{
“jsonrpc”: “2.0”,
“result”: [
{
“itemid”: “59832”,
“value”: “col1 | col2 | col3 | col4\n entry1 | entry2 | entry 3 | entry4”
}
}

Here I need to visualise the data in “value” as a table.

Welcome

Who wrote this api ? Is it a commercial product?

This is the Zabbix Api.

That is a very odd json reply cause its really not proper json nor is it csv. Its pipe delimited.

Yes, I agree. But as of now, I will have to work with the given data only.
Please suggest something with the available data.

not a valid json but cleaned it up here please verify. So which data point(s) do you want to plot? entry ?

{
	"jsonrpc": "2.0",
	"result": [
		{
			"itemid": "59832",
			"value": "col1 | col2 | col3 | col4\n entry1 | entry2 | entry 3 | entry4"
		}
	]
}

I want to plot result[0].value i.e. the value field of the first item in the result array.

Which part of that pipe delimited data do you want to plot on a chart and what kind of chart? What have you tried so far?

I want to convert the complete data mentioned above into a table.

Thanks a lot. I was able to extract the data into a table using jsonata.

I want to keep the first row as the table headers, how can I achieve this?

1 Like

@yosiasz The issue is not fully resolved yet. Please have a look at the list line of my last comment.

1 Like

you will need to sort that out in your jsonata query so that it produces a key value pair

{
"col1" : "entry1"
}
1 Like