'Remove Line Breaks and spaces From Json Object Keys typescript

I have a Json object from Excel sheet conversion and it probably comes with some keys with Line breaks and spaces I want a function to remove all line breaks and spaces from json object keys This is the structure of the json

 {"SOH":[{"MN":"asdf","Part\r\nNumber":"1234"},{"MN":"asdf2","Part\r\nNumber":"12343"}]} 

expected outcome

 {"SOH":[{"MN":"asdf","PartNumber":"1234"},{"MN":"asdf2","PartNumber":"12343"}]} 

Thanks for support



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source