How to fixed Uncaught SyntaxError: Unexpected token } in JSON at position Magento?

Magento page console error Uncaught SyntaxError: Unexpected token } in JSON at position 530 while you have made mistake to your code.

Code with Error in a template file:

Console Error:

I have defined the above custom javascript block using the template file script tag. When checking the above code for the first time, looks correct but when we load the page with this javascript code, it will throw an error.

Here our issue is we have added an extra comma(,) at lines no. 7 and 13 that’s not needed at all.

Once you remove the extra comma from the Object-defined using script tag, your js issue will be resolved.
In the above code snippet, we have added two different places commas at lines no. 7 and 13 that will throw the error.

Correct Code:
Remove all the extra comma from the snippet that is not required in the Script tag.