Click here to Skip to main content
15,030,744 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Now return data as :
{
"ProductID": 1,
"Category": [{
"CategoryID": 1,
"SubCategory": [{
"SubCategoryID": 1,
}]
}]
}

I want converted output data as in typescript:

[{
"ProductID": 1,
"Category": {
"CategoryID": 1,
"SubCategory": {
"SubCategoryID": 1,
}
}
}]

What I have tried:

return this.restApi.getProductBin().subscribe((data: {}) => {

const usersJson: any[] = Array.of(data);
Posted
Comments
Member 11220730 21-Dec-19 6:09am
   
Any solution
Richard MacCutchan 21-Dec-19 10:53am
   
Any question? Please show your code, and explain what is wrong with the results that are produced.
Member 11220730 23-Dec-19 10:55am
   
I want to bind Data contains nested arrays into Kendo Grid required format is
[{
"ProductID": 1,
"Category": {
"CategoryID": 1,
"SubCategory": {
"SubCategoryID": 1,
}
}
}]
Member 11220730 23-Dec-19 11:00am
   
Now return data from rest api as Nested arrays having [] square brackets, i want remove square brackets from below result to bind kendo grid in angular. :
{
"ProductID": 1,
"Category": [{
"CategoryID": 1,
"SubCategory": [{
"SubCategoryID": 1,
}]
}]
}
Richard MacCutchan 23-Dec-19 11:36am
   
I guess you need to use a RegEx or some form of substring function.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900