Extract Field transform displays "null"

  • What Grafana version and what operating system are you using?

v10.1.0

  • What are you trying to achieve?

https://play.grafana.org/d/aac76d76-3493-4f71-99ea-bfd09959b753/extract-field-transform-null-values-issue?orgId=1

I’m using the following data :

{"foo": "dude"}
{"bar": 125, "dude": null}

And using the Transform Data / Extract Field feature.

  • What happened?

Some cells not containing data are empty. Some display a “null” string.

Screenshot from 2023-11-29 16-46-51

  • What did you expect to happen?

I expect the cells not containing data to be empty. (or all of them to contain “null”).

What is the data source for this data

The data source doesn’t seem to be important. I tried first with a SQL query (PostgreSQL backend), but in the sandbox the data is Static.

Actually it is important as you could leverage functions in the querying language of the data source. here is an example in MS SQL

image

or

;with src
as
(
select '{"foo": "dude"}' as zaza union
select '{"bar": 125, "dude": null}'
)

SELECT *
from src
cross apply OPENJSON(src.zaza) WITH (
    foo NVARCHAR(50) '$.foo',
	bar INT '$.bar',
    dude  NVARCHAR(50)  '$.dude'
    );