[resolved] Problem tXmlMap and null value

One Star

[resolved] Problem tXmlMap and null value

I have this structure
Database-tXmlMap-tRestClient to convert xml to json....I have a problem because if i have null value, tRestClient convert null value with "" for example
"chiave":"" this is not correct i will "chiave":"null"
I have try another structure
tDatabase-tWriteJsonField but i have multiple errore for example impossible to convert map(string,sting) to map(string,date) and is impossible to execute this operation


If i have
database-txmlmap-trestclient is possible to insert null value??
Is possibile to use 
Database-tWriteJsonField and resolve the problem of field date?

Accepted Solutions
One Star

Re: [resolved] Problem tXmlMap and null value

Found the solution.
If you got the same problem, in tXMLMap, go to Settings in output part then select "false" for the option "Create empty element".
As empty elements are not sended any more with this option activated, the service now receive null values for the corresponding fields.
That's what I want.
Regards,
Fred

All Replies
Seventeen Stars

Re: [resolved] Problem tXmlMap and null value

What you want is actually not correct because "null" mean nothing else than a String with the content "null". In JSON or XML you have only the chance to leaf the attribute out completely or write an empty string.
One Star

Re: [resolved] Problem tXmlMap and null value

This is a problem, the component for generate Json are wrong..because txml generate null field with "" but a web service use the controll 
if( field == null || ...ecc---all web service
tWriteJsonField generate all field with string value but all web service will deduce the type of a field in base of the syntax of the field....i use a tjava with json library but is not a good solution
One Star

Re: [resolved] Problem tXmlMap and null value

Serve a new component
One Star

Re: [resolved] Problem tXmlMap and null value

Hi,
I have the same problem with tXMLMap (null values changed to "").
Does anyone has a solution for that?
In my case, I have a flow issued from an Excel file transformed to XML by tXMLMap then push to tRESTClient which call a service with JSON content:
tFileInputExcel --> tXMLMap --> tRESTClient
Received messages by the service contain for example "lastContactAdded":"" but "lastContactAdded":null is expected.
Regards,
Fred
One Star

Re: [resolved] Problem tXmlMap and null value

Found the solution.
If you got the same problem, in tXMLMap, go to Settings in output part then select "false" for the option "Create empty element".
As empty elements are not sended any more with this option activated, the service now receive null values for the corresponding fields.
That's what I want.
Regards,
Fred