Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const actualArray = [
- {
- "id": "1ff",
- "tag": "sedan_at",
- "value": "168.30000",
- "unitId": 1,
- "currency": "USD",
- "price": "10000.00000",
- "name": "audi",
- "groupId": 1,
- "groupName": "firstGroup",
- "displaySequence": 1
- },
- {
- "id": "2ch",
- "tag": "sedan_gl",
- "value": "181.00000",
- "unitId": 1,
- "currency": "USD",
- "price": "10000.00000",
- "name": "audi",
- "groupId": 1,
- "groupName": "firstGroup",
- "displaySequence": 1
- },
- {
- "id": "3ff",
- "tag": "hatchBack_at",
- "value": "90",
- "unitId": 2,
- "currency": "USD",
- "price": "6000",
- "name": "mini cooper",
- "groupId": 2,
- "groupName": "secondGroup",
- "displaySequence": 2
- },
- {
- "id": "3kr",
- "tag": "hatchBack_gl",
- "value": "120",
- "unitId": 2,
- "currency": "USD",
- "price": "6000",
- "name": "mini cooper",
- "groupId": 2,
- "groupName": "secondGroup",
- "displaySequence": 2
- }
- const desiredArray = [{
- groupName: "firstGroup",
- displaySequence: "1",
- groupId: 1,
- units: [
- {
- unitId: 1,
- name: "audi",
- performance_targets: {
- "kpis": [
- {
- "actual_value": "168.30000",
- "target_value": "181.00000",
- "currency": "USD",
- }
- ],
- "profit_impact": {
- "value": "10000.000",
- "currency": "USD",
- }
- }
- },
- {
- unitId: 2,
- name: "mini cooper",
- performance_targets: {
- "kpis": [
- {
- "actual_value": "90",
- "target_value": "120",
- "currency": "USD",
- }
- ],
- "profit_impact": {
- "value": "6000.000",
- "currency": "USD",
- }
- }
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement