Mapping text that describes connected devices to a JSON object with chosen shape

I program in JS and am new to AI. I posted in the Beginners forum a month ago and nobody replied.

I want to do the following:

  1. Capture text that says things like:

“Take port 1 of device 3 and connect it to port 5 of device 2. Take device 2 and port ten and connect to port 22 of device 30”

  1. Convert it to a JSON object that has a consistent shape (The shape of the data does not change on each conversion) that describes those connections.
let connections = [
     [{device:3, port:1, connect:{device:2, port:5}}],
     [{device:2, port:10, connect:{device:30, port:22}}
]

I am curious if their are any libraries that make this simple or if not, what are some ways I can leverage all the tools that already exist as shortcuts? Basically if you were to do this, what are the immediate steps to get there?

I’m curious if I need to create my own dataset to do this, and if not what short cuts are available etc.

There is a lot I don’t know so excuse my ignorance.

Thank you!

Is this similar?

No this is not what I am looking for