Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a43af3b
Update README.md
divyanshugour Jan 23, 2023
4a91913
Update README.md
divyanshugour Jan 23, 2023
3a9e84f
Update README.md
divyanshugour Jan 23, 2023
3f3716e
initial commit
divyanshugour Apr 20, 2023
2a1a1e4
completed 2nd transformation
divyanshugour Apr 20, 2023
3af8119
completed 3rd transformation
divyanshugour Apr 20, 2023
269bdb8
completed 9th transformation
divyanshugour Apr 20, 2023
13ba941
completed 11th transformation
divyanshugour Apr 20, 2023
cd08457
completed 21st transformation
divyanshugour Apr 21, 2023
8ba5976
completed 5th transformation
divyanshugour Apr 21, 2023
9b8f386
completed 10th transformation
divyanshugour Apr 21, 2023
a800780
completed 12th transformation
divyanshugour Apr 21, 2023
5cccd1f
completed 4th transformation
divyanshugour Apr 21, 2023
ce142d1
completed 7th transformation
divyanshugour Apr 21, 2023
74ccb08
completed 13th transformation
divyanshugour Apr 21, 2023
d9875b6
completed 17th transformation
divyanshugour Apr 21, 2023
878d948
completed 18th transformation
divyanshugour Apr 21, 2023
dae6262
completed 30th transformation
divyanshugour Apr 21, 2023
96ff643
completed 32th transformation
divyanshugour Apr 21, 2023
ec9f510
completed 31th transformation
divyanshugour Apr 21, 2023
ccecfda
completed 29th transformation
divyanshugour Apr 21, 2023
2066195
completed 24th transformation
divyanshugour Apr 21, 2023
b996907
completed 26th transformation
divyanshugour Apr 21, 2023
a0490d8
completed 27th transformation
divyanshugour Apr 21, 2023
1acb67a
completed 22nd transformation
divyanshugour Apr 21, 2023
a797ea2
completed 23rd transformation
divyanshugour Apr 21, 2023
2b41ed8
completed 14th transformation
divyanshugour Apr 21, 2023
b22fc83
completed 25th transformation
divyanshugour Apr 22, 2023
d391b6b
completed 26th transformation
divyanshugour Apr 22, 2023
6536710
completed 33th transformation
divyanshugour Apr 22, 2023
04413e4
completed 6th transformation
divyanshugour Apr 22, 2023
a9be2c1
completed 1st transformation
divyanshugour Apr 23, 2023
6c312ba
completed 19th transformation
divyanshugour Apr 23, 2023
4d537c7
completed 8th transformation
divyanshugour Apr 23, 2023
183b779
completed 28th transformation
divyanshugour Apr 23, 2023
ac4e553
completed 34th transformation
divyanshugour Apr 23, 2023
35ffbc0
completed 16th transformation
divyanshugour Apr 23, 2023
7a9ee0e
All completed, 15 and 20 remaining, optimization remaining
divyanshugour Apr 24, 2023
1aa5bc6
completed 20th transformation
divyanshugour Apr 25, 2023
1df6995
added approch.md to all transformations
divyanshugour May 23, 2023
2a06a0b
updates output.json
divyanshugour May 23, 2023
4388b40
updated with correct spec
divyanshugour May 23, 2023
3eb2c29
Correct Output
divyanshugour May 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions 10_transformation/approach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Number of Operations: 2

1. modify-overwrite-beta
2. remove
3. modify-overwrite-beta

### Explanation:

1. In first modify-overwrite-beta operation splited the name into first_name and last_name key.

2. In second remove operation removed the name key.

3. In last modify-overwrite-beta operation stored the length of phone_numbers list into phone_number_count key using the size method.
20 changes: 20 additions & 0 deletions 10_transformation/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "John Smith",
"age": 35,
"address": {
"street": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip": "12345"
},
"phone_numbers": [
{
"type": "home",
"number": "555-1234"
},
{
"type": "work",
"number": "555-5678"
}
]
}
20 changes: 20 additions & 0 deletions 10_transformation/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"age" : 35,
"address" : {
"street" : "123 Main St",
"city" : "Anytown",
"state" : "CA",
"zip" : "12345"
},
"phone_numbers" : [ {
"type" : "home",
"number" : "555-1234"
}, {
"type" : "work",
"number" : "555-5678"
} ],
"first_name" : "John",
"last_name" : "Smith",
"phone_number_count" : 2
}

21 changes: 21 additions & 0 deletions 10_transformation/spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[{
"operation": "modify-overwrite-beta",
"spec": {
"name": "=split(' ',@(1,name))",
"first_name": "=firstElement(@(1,name))",
"last_name": "=lastElement(@(1,name))"
}
},
{
"operation": "remove",
"spec": {
"name": ""
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"phone_number_count": "=size(@(1,phone_numbers))"
}
}
]
7 changes: 7 additions & 0 deletions 11_transformation/approach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Number of Operations: 1

1. shift

### Explanation:

1. Used shift operation to replace the itemName and itemValue keys with name and value respectively and shifting both values inside a items list.
12 changes: 12 additions & 0 deletions 11_transformation/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"items": [
{
"name": "item1",
"value": 10
},
{
"name": "item2",
"value": 20
}
]
}
12 changes: 12 additions & 0 deletions 11_transformation/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"items": [
{
"itemName": "item1",
"itemValue": 10
},
{
"itemName": "item2",
"itemValue": 20
}
]
}
14 changes: 14 additions & 0 deletions 11_transformation/spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"operation": "shift",
"spec": {
"items": {
"*": {
"name": "items.[#2].itemName",
"value": "items.[#2].itemValue"
}
}
}
}
]

13 changes: 13 additions & 0 deletions 12_transformation/approach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Number of Operations: 2

1. modify-overwrite-beta
2. remove
3. shift

### Explanation:

1. In first modify-overwrite-beta operation concated the firstName and lastName to make name key and street, city, state and zip to make address key.

2. In seond remove operation removed the firstName and the lastName key.

3. In last shift operation printed the value of name and address key as it is and replaced the phones map key with phoneNumbers.
22 changes: 22 additions & 0 deletions 12_transformation/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"employee": {
"firstName": "John",
"lastName": "Doe",
"address": {
"street": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip": "12345"
},
"phones": [
{
"type": "home",
"number": "555-555-1234"
},
{
"type": "work",
"number": "555-555-5678"
}
]
}
}
12 changes: 12 additions & 0 deletions 12_transformation/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name" : "John Doe",
"address" : "123 Main St, Anytown, CA 12345",
"phoneNumbers" : [ {
"type" : "home",
"number" : "555-555-1234"
}, {
"type" : "work",
"number" : "555-555-5678"
} ]
}

29 changes: 29 additions & 0 deletions 12_transformation/spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[{
"operation": "modify-overwrite-beta",
"spec": {
"employee": {
"name": "=concat(@(1,firstName),' ',@(1,lastName))",
"address": "=concat(@(0,street),', ',@(0,city),', ',@(0,state),' ',@(0,zip))"
}
}
},
{
"operation": "remove",
"spec": {
"employee": {
"firstName": "",
"lastName": ""
}
}
},
{
"operation": "shift",
"spec": {
"employee": {
"name": "&",
"address": "&",
"phones": "phoneNumbers"
}
}
}
]
7 changes: 7 additions & 0 deletions 13_transformation/approach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Number of Operations: 1

1. shift

### Explanation:

1. In shift operation shifted the values of name and departement inside a map with key as the id that we catched by using the @ wildcard 1 level up.
19 changes: 19 additions & 0 deletions 13_transformation/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"employees": [
{
"id": "001",
"name": "John",
"department": "HR"
},
{
"id": "002",
"name": "Jane",
"department": "Sales"
},
{
"id": "003",
"name": "Bob",
"department": "IT"
}
]
}
15 changes: 15 additions & 0 deletions 13_transformation/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"001" : {
"name" : "John",
"department" : "HR"
},
"002" : {
"name" : "Jane",
"department" : "Sales"
},
"003" : {
"name" : "Bob",
"department" : "IT"
}
}

14 changes: 14 additions & 0 deletions 13_transformation/spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"operation": "shift",
"spec": {
"employees": {
"*": {
"name": "@(1,id).name",
"department": "@(1,id).department"
}
}
}
}
]

8 changes: 8 additions & 0 deletions 14_transformation/approach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Number of Operations: 3

1. modify-overwrite-beta
2. remove
3. shift


### Explanation:
35 changes: 35 additions & 0 deletions 14_transformation/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"employees": [
{
"id": "001",
"name": "John",
"department": "HR",
"phone": [
{
"type": "home",
"number": "555-555-1234"
},
{
"type": "work",
"number": "555-555-5678"
}
]
},
{
"id": "002",
"name": "Jane",
"department": "Sales",
"phone": [
{
"type": "home",
"number": "555-555-4567"
},
{
"type": "work",
"number": "555-555-8901"
}
]
}
]
}

19 changes: 19 additions & 0 deletions 14_transformation/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"employees": [
{
"id": "001",
"name": "John",
"department": "HR",
"homePhone": "555-555-1234",
"workPhone": "555-555-5678"
},
{
"id": "002",
"name": "Jane",
"department": "Sales",
"homePhone": "555-555-4567",
"workPhone": "555-555-8901"
}
]
}

34 changes: 34 additions & 0 deletions 14_transformation/spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"operation": "modify-overwrite-beta",
"spec": {
"employees": {
"*": {
"phone": {
"*": {
"type": "=concat(@(1,type),'Phone')"
}
}
}
}
}
},
{
"operation": "shift",
"spec": {
"employees": {
"*": {
"id": "[#2].&",
"name": "[#2].&",
"department": "[#2].&",
"phone": {
"*": {
"number": "[#4].@(1,type)"
}
}
}
}
}
}
]

8 changes: 8 additions & 0 deletions 16_transformation/approach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Number of Operations: 3

1. modify-overwrite-beta
2. remove
3. shift


### Explanation:
Loading