Extra '\' in Javascript?
This article explains why Instance expressions in HighByte Intelligence Hub sometimes display an “extra” backslash (\\)
Summary:
What looks like an "extra slash" is almost always the JSON escape of a backslash ( \ ) being displayed in the UI. You're not looking at raw JavaScript source in those views; you're looking at a JSON representation of data/events. JSON shows a single backslash as \\, so it can be interpreted correctly.
Where This Shows Up and Why:
- UNS client
- The Inspector can auto-detect and explicitly display payloads as Text, JSON, Sparkplug B, or Raw. When JSON is selected/detected, strings are displayed using JSON's escape rules, so \ appears as \\
- Pipeline Debug
- Debug mode is designed to simulate and visually inspect what each stage does to the event; you're seeing structured values (objects/arrays/strings), not JavaScript source code. When the value is shown as JSON, the same escape rules apply.
The Key Rule You're Observing:
HighByte's Application Setting doc illustrates the escape with Windows paths in settings.
“Specifying a Windows path requires any path delimiters (\) to be properly escaped… C:\\ProgramData\\HighByte\\Intelligence Hub.”
That's the exact behavior you're seeing in the UI: a single literal backslash is serialized as \\ when displayed as JSON.
Why This Is Necessary In The Product
- Correct typing of inbound data
- API-triggered pipeline treats JSON content types as JSON values (and non-JSON as strings). Rendering with escapes ensures the value you see is exactly what the engine reads and passes through stages
- Reliable data transmission across stages
- Pipelines commonly process and format JSON. Showing escaped characters ensures paths and other strings survive parse/format cycles without accidental control sequences