Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does tWriteJSONField create an array for null values?

I have joined Countries to Locations in the HR Sample database in OracleXE.

I am then using a tMap to generate a nested JSON document.

enter image description here

it works, but for some reason null values in the Location are coming through as arrays in the final output in the console (have also tried MongoDB).

enter image description here

like image 978
smackenzie Avatar asked Apr 15 '26 23:04

smackenzie


1 Answers

I believe the elegant (and short) solution would be the following.

Talend docs state that:

When configuring a JSON tree, the default type of an element is string. If an element is not of type string, you need to add an attribute for the element to set its type.

So, to the object receiving a null value, you should add an attribute named class and set its static value to object.

Pic: JSON Tree Configuration

And voilà!

PIC: "Complemento":null

like image 126
Gustavo Regal Avatar answered Apr 18 '26 12:04

Gustavo Regal