It looks like you have used string manipulation rather than JSON parsing.
I say look because it's hard to tell from how you have posted - please use the "copy value" button so we get correctly formatted data & always put code in a code block:
getting data from node-red debug:
There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path/value for any data item.
Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.
Property formatting posted code
In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```
)
```
code goes here
```
You can edit and correct your post by clicking the pencil icon.
See this post for more details - How to share code or flow json