I need to convert the kebab case into camel case.
The depth of the JSON object can be up to 5 child elements. I tried to implement it (see here), but the output is not the expected.
Input:
{
"is-success": true,
"response-date": "2019-02-20T11:42:11.963Z",
"result": {
"record-count": "abc123",
"bill-details-list": [
{
"source-system": "Abc123",
"bill-info": {
"bill-amount": "Abc123"
}
},
{
"SourceSystem": "abc123",
"bill-info": {
"bill-amount-po": "Abc123"
}
}
]
}
};
Current output:
{
isSuccess: true,
responseDate: '2019-02-20T11:42:11.963Z',
result: { recordCount: 'abc123', 'billDetailsList': [ [Object], [Object] ] }
}
Expected output:
{
"isSuccess": true,
"responseDate": "2019-02-20T11:42:11.963Z",
"result": {
"recordCount": "abc123",
"billDetailsList": [
{
"sourceSystem": "Abc123",
"billInfo": {
"billAmountPo": "Abc123"
}
},
{
"sourceSystem": "abc123",
"billInfo": {
"billAmountPo": "Abc123"
}
}
]
}
};