In the process of developing my Angular 4 application, I am interfacing with a REST API through JSON requests.
As I work on creating JSON objects to send via POST requests, I find myself putting in quite a bit of manual effort to construct them...
I KNOW THERE MUST BE A MORE EFFICIENT WAY to do this, whether it's through using a specific library or some clever TypeScript technique. However, I have yet to come across one and would appreciate any suggestions.
const addressJson = ' { \n ' + this.jsonFormatField('Address', serviceAddress.address) + ',' +
this.jsonFormatField('Address2', serviceAddress.address2) + '\n,' +
this.jsonFormatField('City', address3) + '\n,' +