Removing escape characters from JSON output

Hello all, probably a newb question:

I have a Workflow to update an object variable using a formula.

The formula is this:

concatenate("{\"id\":",context.item.parent?.['data']?.['id'],", \"score\":",context.item.data?.['score'],"}")

The JSON in the object variable now reads:

"{\"id\":3, \"score\":0}"

I need it to read:

{"id":3, "score":0}

However, when I remove the backslash escape characters from the formula, it’s clearly wrong as it says:

“missing ) after argument list”

This is hopefully a simple syntax question, but can’t work it out.

Have searched forums and asked ChatGPT to no avail. The AI formula builder always tells me there’s an error. Hoping this is an easy one for the humans : )

You have your object in a string format. In order to transform it into an object again, you can parse it. JSON.parse(<your_variable_here>)

Edit: Even a simpler way to do this would be to just do the following in the formula editor:

{"id": context.item.parent?.['data']?.['id'], "score": context.item.data?.['score']}