I have a TypedInput of type "json", and I pass a default array to it:
But when I open the JSON editor, the array is considered incorrect:
So the quotes and rectangular brackets are gone.
Must be something stupid, but need a fresh pair of eyes to look at this code snippet ...
And I was so sure that I already had used it before, but couldn't find anything...
@knolleary: thanks for the explanation and confirmation!
If anybody is ever searching for it:
- Set the "json" typedInput value:
myInputField.typedInput("value", JSON.stringify(value || ));
- Get the "json" typedInput value:
var value = JSON.parse(myInputField.typedInput('value'));
Not really Bart, you should use
RED.util.evaluateNodeProperty which will parse the JSON according.
Ah yes Steve,
That is why I couldn't find it anymore. After a heavy day at work completely forgotten about that one...
Every time I look at that functions parameters, I always have to remind myself whether this is used for node or msg fields or both.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.