Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Handling Java time stamps (longs) in a tWriteJSONField

I'm trying to write Java timestamps out to a JSON object using tWriteJSONField, and not getting very far.

 

Not setting the type attribute yields the timestamp in a quoted string (E.g., "1531434936872")

Setting the type attribute to "integer" yields a NumberFormatException

Setting the type attribute to "number" turns the timestamp into a double (E.g., 1.531434846295E12)

Setting the type attribute to "object" yields an empty object ("{}")

 

Is there a way to handle this?

Labels (4)
2 Replies
Anonymous
Not applicable
Author

Hello,

Could you please elaborate your case with an example with input and expected output values?

Best regards

Sabrina

Anonymous
Not applicable
Author

Given this simple job:

 

0683p000009LzHh.png

Where the row generator queries the current system time like this

0683p000009LzAw.png

And the JSON tree in tWriteJSONField is configured like this:

0683p000009LzHm.png

I get the following output:

Starting job TestJavaTimestamp at 09:18 16/07/2018.

[statistics] connecting to socket on port 3627
[statistics] connected
{"currentTime":1.531757903116E12}
[statistics] disconnected
Job TestJavaTimestamp ended at 09:18 16/07/2018. [exit code=0]

I would expect output like this:

{"currentTime":1531757892465}