OPC-UA Server - NaN values in complex datatype

We have a complex data type with double values which are set to NaN if not available. Ignition translates complex data types to a json string. We did an upgrade to Ignition 3.8.6 recently and run into an issue:
The NaN lead to a non valid JSON structure like: {"value": NaN} instead of {"value": "NaN"} or {"value:": null}.

Is this expected?

Expected? Yes-ish. Correct? Debatable...

GSON's parsing and toString() methods use lenient mode, so this gets through and can roundtrip serialize in Ignition.

I'll keep looking to see if there's some safe change we can make here... I'd prefer to see the decoding always produce strictly valid JSON.

It’s not about following the formal json specification (although it would be good), but the system.jsonDecode throws an exception with the NaN. Maybe we can use another library/method to decode it safe

I opened a ticket and found a fairly isolated fix (on our side) for this, hopefully it'll sneak into the next release, but not sure yet.

Thank you, just want to add that the issue is not jsonDecode, its internally in the EventStream Filter stage:
When we trigger a event stream with a json document including a NaN, the filter drops the event, even if we deactive the filter, no values pass..

If we remove the NaN value from the source tag, everything is fine.

We did some further tests to fix the issue temporarily. The likelyhood to get into this situation is not very high but it is like this:

Behavior:

  1. Ignition OPC-UA clients reads a complex data type value from an external OPC-UA server
  2. It writes the value as a (invalid) json (due to NaN) to a memory tag, which is configured as a Document type
  3. The memory tag accepts it, also it complains if you try to do this manually via the Tag Browser
  4. This memory tag triggers an Event Stream which then fails to convert it to a valid JSON in between the Filter and Transform Stage

Quick fix:

  • Change memory tag to a string.
  • Don't expect a json/dict in the Filter stage (its now a string)
  • Convert the event value to a valid json via the util.decodeJson in the TransformStage