Change JSON field type to allow JSONC

Hi, sorry if this has been asked for previously.

It would be really useful if the JSON input field were changed to allow JSONC (JSON with comments).

Here is an example of JSONC:

{
    "topic": "Optional. Can be anything",
    "_uib": { // Required
        // This is a pseudo ref, you don't have to actually put it in your HTML
        "componentRef": "globalNotification",
        // Optional.
        "options": {
            "title": "Notification Title", // Optional. String or HTML.
            "content": "Optional. A string. Will appear second in the resulting pop-up. Can be HTML.",
            "append": false, // Optional. If TRUE, new notifications are added to the END of the list instead of the start.
            "autoHideDelay": 500, // Optional. If set, must be the number of milliseconds to display the notification.
            // Other Toasts options may also be included, see the bootstrap-vue and bootstrap documentation for details.
        }
    },
    "payload": "Optional. A string. Will appear first in the resulting pop-up. Can be HTML."
}
1 Like

Thanks for the reminder though that was really dealing with flow files in the end wasn't it?

What I'm thinking of here is just for JSON input field. JSONC is a pretty well established format and simply allows comments to be added to JSON.

That wouldn't have any impact on the running or structure of Node-RED I don't think?

But it would break every node that parses the field expecting it to be JSON.

Seems my brain had got ahead of itself - I was thinking that there would be a difference between the input and the output. Rather like what happens with JSONata. So that the comments would be stripped from the input before outputting to the flow.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.