From ebeb94c90d5c557522977aef28492c9b63972623 Mon Sep 17 00:00:00 2001 From: Kunal Date: Mon, 22 May 2023 23:04:54 +0530 Subject: [PATCH 01/12] Solved all Problems of Module-5 JOLT Transformation --- Problem1/input.json | 58 +++++++++++++++++++++++++++++++++ Problem1/output.json | 40 +++++++++++++++++++++++ Problem1/spec.json | 40 +++++++++++++++++++++++ Problem10/input.json | 20 ++++++++++++ Problem10/output.json | 19 +++++++++++ Problem10/spec.json | 17 ++++++++++ Problem11/input.json | 12 +++++++ Problem11/output.json | 9 ++++++ Problem11/spec.json | 13 ++++++++ Problem12/input.json | 22 +++++++++++++ Problem12/output.json | 11 +++++++ Problem12/spec.json | 21 ++++++++++++ Problem13/input.json | 19 +++++++++++ Problem13/output.json | 16 ++++++++++ Problem13/spec.json | 22 +++++++++++++ Problem14/input.json | 34 ++++++++++++++++++++ Problem14/output.json | 13 ++++++++ Problem14/spec.json | 23 ++++++++++++++ Problem15/input.json | 52 ++++++++++++++++++++++++++++++ Problem15/output.json | 45 ++++++++++++++++++++++++++ Problem15/spec.json | 68 +++++++++++++++++++++++++++++++++++++++ Problem16/input.json | 30 ++++++++++++++++++ Problem16/output.json | 16 ++++++++++ Problem16/spec.json | 0 Problem17/input.json | 21 ++++++++++++ Problem17/output.json | 18 +++++++++++ Problem17/spec.json | 12 +++++++ Problem18/input.json | 19 +++++++++++ Problem18/output.json | 15 +++++++++ Problem18/spec.json | 23 ++++++++++++++ Problem19/input.json | 19 +++++++++++ Problem19/output.json | 15 +++++++++ Problem19/spec.json | 31 ++++++++++++++++++ Problem2/input.json | 5 +++ Problem2/output.json | 5 +++ Problem2/spec.json | 10 ++++++ Problem21/input.json | 10 ++++++ Problem21/output.json | 4 +++ Problem21/spec.json | 12 +++++++ Problem22/input.json | 22 +++++++++++++ Problem22/output.json | 5 +++ Problem22/spec.json | 14 ++++++++ Problem23/input.json | 22 +++++++++++++ Problem23/output.json | 7 ++++ Problem23/spec.json | 17 ++++++++++ Problem24/input.json | 42 ++++++++++++++++++++++++ Problem24/output.json | 11 +++++++ Problem24/spec.json | 23 ++++++++++++++ Problem25/input.json | 42 ++++++++++++++++++++++++ Problem25/output.json | 21 ++++++++++++ Problem25/spec.json | 23 ++++++++++++++ Problem26/input.json | 14 ++++++++ Problem26/output.json | 9 ++++++ Problem26/spec.json | 24 ++++++++++++++ Problem27/input.json | 23 ++++++++++++++ Problem27/output.json | 16 ++++++++++ Problem27/spec.json | 42 ++++++++++++++++++++++++ Problem28/input.json | 45 ++++++++++++++++++++++++++ Problem28/output.json | 7 ++++ Problem28/spec.json | 23 ++++++++++++++ Problem29/input.json | 10 ++++++ Problem29/output.json | 6 ++++ Problem29/spec.json | 15 +++++++++ Problem3/input.json | 6 ++++ Problem3/output.json | 8 +++++ Problem3/spec.json | 11 +++++++ Problem30/input.json | 18 +++++++++++ Problem30/output.json | 5 +++ Problem30/spec.json | 16 ++++++++++ Problem31/input.json | 21 ++++++++++++ Problem31/output.json | 6 ++++ Problem31/spec.json | 31 ++++++++++++++++++ Problem32/input.json | 24 ++++++++++++++ Problem32/output.json | 10 ++++++ Problem32/spec.json | 12 +++++++ Problem33/input.json | 14 ++++++++ Problem33/output.json | 11 +++++++ Problem33/spec.json | 15 +++++++++ Problem34/input.json | 7 ++++ Problem34/output.json | 10 ++++++ Problem34/spec.json | 16 ++++++++++ Problem4/input.json | 9 ++++++ Problem4/output.json | 15 +++++++++ Problem4/spec.json | 14 ++++++++ Problem5/input.json | 11 +++++++ Problem5/output.json | 6 ++++ Problem5/spec.json | 20 ++++++++++++ Problem6/input.json | 44 +++++++++++++++++++++++++ Problem6/output.json | 9 ++++++ Problem6/spec.json | 27 ++++++++++++++++ Problem7/input.json | 14 ++++++++ Problem7/output.json | 11 +++++++ Problem7/spec.json | 25 +++++++++++++++ Problem8/input.json | 17 ++++++++++ Problem8/output.json | 19 +++++++++++ Problem8/spec.json | 74 +++++++++++++++++++++++++++++++++++++++++++ Problem9/input.json | 10 ++++++ Problem9/output.json | 9 ++++++ Problem9/spec.json | 10 ++++++ problem20/input.json | 28 ++++++++++++++++ problem20/output.json | 20 ++++++++++++ problem20/spec.json | 64 +++++++++++++++++++++++++++++++++++++ 102 files changed, 2019 insertions(+) create mode 100644 Problem1/input.json create mode 100644 Problem1/output.json create mode 100644 Problem1/spec.json create mode 100644 Problem10/input.json create mode 100644 Problem10/output.json create mode 100644 Problem10/spec.json create mode 100644 Problem11/input.json create mode 100644 Problem11/output.json create mode 100644 Problem11/spec.json create mode 100644 Problem12/input.json create mode 100644 Problem12/output.json create mode 100644 Problem12/spec.json create mode 100644 Problem13/input.json create mode 100644 Problem13/output.json create mode 100644 Problem13/spec.json create mode 100644 Problem14/input.json create mode 100644 Problem14/output.json create mode 100644 Problem14/spec.json create mode 100644 Problem15/input.json create mode 100644 Problem15/output.json create mode 100644 Problem15/spec.json create mode 100644 Problem16/input.json create mode 100644 Problem16/output.json create mode 100644 Problem16/spec.json create mode 100644 Problem17/input.json create mode 100644 Problem17/output.json create mode 100644 Problem17/spec.json create mode 100644 Problem18/input.json create mode 100644 Problem18/output.json create mode 100644 Problem18/spec.json create mode 100644 Problem19/input.json create mode 100644 Problem19/output.json create mode 100644 Problem19/spec.json create mode 100644 Problem2/input.json create mode 100644 Problem2/output.json create mode 100644 Problem2/spec.json create mode 100644 Problem21/input.json create mode 100644 Problem21/output.json create mode 100644 Problem21/spec.json create mode 100644 Problem22/input.json create mode 100644 Problem22/output.json create mode 100644 Problem22/spec.json create mode 100644 Problem23/input.json create mode 100644 Problem23/output.json create mode 100644 Problem23/spec.json create mode 100644 Problem24/input.json create mode 100644 Problem24/output.json create mode 100644 Problem24/spec.json create mode 100644 Problem25/input.json create mode 100644 Problem25/output.json create mode 100644 Problem25/spec.json create mode 100644 Problem26/input.json create mode 100644 Problem26/output.json create mode 100644 Problem26/spec.json create mode 100644 Problem27/input.json create mode 100644 Problem27/output.json create mode 100644 Problem27/spec.json create mode 100644 Problem28/input.json create mode 100644 Problem28/output.json create mode 100644 Problem28/spec.json create mode 100644 Problem29/input.json create mode 100644 Problem29/output.json create mode 100644 Problem29/spec.json create mode 100644 Problem3/input.json create mode 100644 Problem3/output.json create mode 100644 Problem3/spec.json create mode 100644 Problem30/input.json create mode 100644 Problem30/output.json create mode 100644 Problem30/spec.json create mode 100644 Problem31/input.json create mode 100644 Problem31/output.json create mode 100644 Problem31/spec.json create mode 100644 Problem32/input.json create mode 100644 Problem32/output.json create mode 100644 Problem32/spec.json create mode 100644 Problem33/input.json create mode 100644 Problem33/output.json create mode 100644 Problem33/spec.json create mode 100644 Problem34/input.json create mode 100644 Problem34/output.json create mode 100644 Problem34/spec.json create mode 100644 Problem4/input.json create mode 100644 Problem4/output.json create mode 100644 Problem4/spec.json create mode 100644 Problem5/input.json create mode 100644 Problem5/output.json create mode 100644 Problem5/spec.json create mode 100644 Problem6/input.json create mode 100644 Problem6/output.json create mode 100644 Problem6/spec.json create mode 100644 Problem7/input.json create mode 100644 Problem7/output.json create mode 100644 Problem7/spec.json create mode 100644 Problem8/input.json create mode 100644 Problem8/output.json create mode 100644 Problem8/spec.json create mode 100644 Problem9/input.json create mode 100644 Problem9/output.json create mode 100644 Problem9/spec.json create mode 100644 problem20/input.json create mode 100644 problem20/output.json create mode 100644 problem20/spec.json diff --git a/Problem1/input.json b/Problem1/input.json new file mode 100644 index 00000000..43328ae1 --- /dev/null +++ b/Problem1/input.json @@ -0,0 +1,58 @@ +{ + "orders": [ + { + "orderId": 1, + "orderDate": "2022-02-20T12:34:56Z", + "customer": { + "customerId": 1, + "firstName": "John", + "lastName": "Doe", + "email": "johndoe@example.com", + "address": { + "street": "123 Main St", + "city": "Anytown", + "state": "CA", + "zip": "12345" + } + }, + "items": [ + { + "itemId": 1, + "name": "Product A", + "quantity": 2, + "price": 10.0 + }, + { + "itemId": 2, + "name": "Product B", + "quantity": 1, + "price": 20.0 + } + ] + }, + { + "orderId": 2, + "orderDate": "2022-02-21T09:12:34Z", + "customer": { + "customerId": 2, + "firstName": "Jane", + "lastName": "Smith", + "email": "janesmith@example.com", + "address": { + "street": "456 Oak St", + "city": "Somewhere", + "state": "NY", + "zip": "67890" + } + }, + "items": [ + { + "itemId": 3, + "name": "Product C", + "quantity": 3, + "price": 15.0 + } + ] + } + ] +} \ No newline at end of file diff --git a/Problem1/output.json b/Problem1/output.json new file mode 100644 index 00000000..6a4f0d27 --- /dev/null +++ b/Problem1/output.json @@ -0,0 +1,40 @@ +{ + "orders" : [ { + "orderId" : 1, + "orderDate" : "2022-02-20T12:34:56Z", + "customer" : { + "customerId" : 1, + "email" : "johndoe@example.com", + "address" : "123 Main St, Anytown, CA 12345", + "fullName" : "John Doe" + }, + "items" : [ { + "itemId" : 1, + "name" : "Product A", + "quantity" : 2, + "price" : 10 + }, { + "itemId" : 2, + "name" : "Product B", + "quantity" : 1, + "price" : 20 + } ], + "total" : 40.0 + }, { + "orderId" : 2, + "orderDate" : "2022-02-21T09:12:34Z", + "customer" : { + "customerId" : 2, + "email" : "janesmith@example.com", + "address" : "456 Oak St, Somewhere, NY 67890", + "fullName" : "Jane Smith" + }, + "items" : [ { + "itemId" : 3, + "name" : "Product C", + "quantity" : 3, + "price" : 15 + } ], + "total" : 45.0 + } ] +} \ No newline at end of file diff --git a/Problem1/spec.json b/Problem1/spec.json new file mode 100644 index 00000000..6a4f0d27 --- /dev/null +++ b/Problem1/spec.json @@ -0,0 +1,40 @@ +{ + "orders" : [ { + "orderId" : 1, + "orderDate" : "2022-02-20T12:34:56Z", + "customer" : { + "customerId" : 1, + "email" : "johndoe@example.com", + "address" : "123 Main St, Anytown, CA 12345", + "fullName" : "John Doe" + }, + "items" : [ { + "itemId" : 1, + "name" : "Product A", + "quantity" : 2, + "price" : 10 + }, { + "itemId" : 2, + "name" : "Product B", + "quantity" : 1, + "price" : 20 + } ], + "total" : 40.0 + }, { + "orderId" : 2, + "orderDate" : "2022-02-21T09:12:34Z", + "customer" : { + "customerId" : 2, + "email" : "janesmith@example.com", + "address" : "456 Oak St, Somewhere, NY 67890", + "fullName" : "Jane Smith" + }, + "items" : [ { + "itemId" : 3, + "name" : "Product C", + "quantity" : 3, + "price" : 15 + } ], + "total" : 45.0 + } ] +} \ No newline at end of file diff --git a/Problem10/input.json b/Problem10/input.json new file mode 100644 index 00000000..1dbe5be1 --- /dev/null +++ b/Problem10/input.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/Problem10/output.json b/Problem10/output.json new file mode 100644 index 00000000..3d677d2e --- /dev/null +++ b/Problem10/output.json @@ -0,0 +1,19 @@ +{ + "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 +} \ No newline at end of file diff --git a/Problem10/spec.json b/Problem10/spec.json new file mode 100644 index 00000000..6c722ccf --- /dev/null +++ b/Problem10/spec.json @@ -0,0 +1,17 @@ +[ + { + "operation": "modify-overwrite-beta", + "spec": { + "name": "=split(' ',@(1,name))", + "first_name": "=firstElement(@(1,name))", + "last_name": "=lastElement(@(1,name))", + "phone_number_count": "=size(@(1,phone_numbers))" + } + }, + { + "operation": "remove", + "spec": { + "name": "" + } + } +] \ No newline at end of file diff --git a/Problem11/input.json b/Problem11/input.json new file mode 100644 index 00000000..1584e681 --- /dev/null +++ b/Problem11/input.json @@ -0,0 +1,12 @@ +{ + "items": [ + { + "name": "item1", + "value": 10 + }, + { + "name": "item2", + "value": 20 + } + ] +} \ No newline at end of file diff --git a/Problem11/output.json b/Problem11/output.json new file mode 100644 index 00000000..1eda48b4 --- /dev/null +++ b/Problem11/output.json @@ -0,0 +1,9 @@ +{ + "items" : [ { + "itemName" : "item1", + "itemValue" : 10 + }, { + "itemName" : "item2", + "itemValue" : 20 + } ] +} \ No newline at end of file diff --git a/Problem11/spec.json b/Problem11/spec.json new file mode 100644 index 00000000..10f02caf --- /dev/null +++ b/Problem11/spec.json @@ -0,0 +1,13 @@ +[ + { + "operation": "shift", + "spec": { + "items": { + "*": { + "name": "items.[#2].itemName", + "value": "items.[#2].itemValue" + } + } + } + } +] \ No newline at end of file diff --git a/Problem12/input.json b/Problem12/input.json new file mode 100644 index 00000000..535141dd --- /dev/null +++ b/Problem12/input.json @@ -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" + } + ] + } +} \ No newline at end of file diff --git a/Problem12/output.json b/Problem12/output.json new file mode 100644 index 00000000..ffd0ebfb --- /dev/null +++ b/Problem12/output.json @@ -0,0 +1,11 @@ +{ + "name" : "John Doe", + "address" : "123 Main St, Anytown, CA 12345", + "phones" : [ { + "type" : "home", + "number" : "555-555-1234" + }, { + "type" : "work", + "number" : "555-555-5678" + } ] +} \ No newline at end of file diff --git a/Problem12/spec.json b/Problem12/spec.json new file mode 100644 index 00000000..3221f76a --- /dev/null +++ b/Problem12/spec.json @@ -0,0 +1,21 @@ +[ + { + "operation": "modify-overwrite-beta", + "spec": { + "employee": { + "name": "=concat(@(1,firstName),' ',@(1,lastName))", + "address": "=concat(@(0,street),', ',@(0,city),', ',@(0,state),' ',@(0,zip))" + } + } + }, + { + "operation": "shift", + "spec": { + "employee": { + "name": "&", + "address": "&", + "phones": "&" + } + } + } +] \ No newline at end of file diff --git a/Problem13/input.json b/Problem13/input.json new file mode 100644 index 00000000..b60b3cc2 --- /dev/null +++ b/Problem13/input.json @@ -0,0 +1,19 @@ +{ + "employees": [ + { + "id": "001", + "name": "John", + "department": "HR" + }, + { + "id": "002", + "name": "Jane", + "department": "Sales" + }, + { + "id": "003", + "name": "Bob", + "department": "IT" + } + ] +} \ No newline at end of file diff --git a/Problem13/output.json b/Problem13/output.json new file mode 100644 index 00000000..73152a06 --- /dev/null +++ b/Problem13/output.json @@ -0,0 +1,16 @@ +{ + "employees" : { + "001" : { + "name" : "John", + "department" : "HR" + }, + "002" : { + "name" : "Jane", + "department" : "Sales" + }, + "003" : { + "name" : "Bob", + "department" : "IT" + } + } +} \ No newline at end of file diff --git a/Problem13/spec.json b/Problem13/spec.json new file mode 100644 index 00000000..a3086867 --- /dev/null +++ b/Problem13/spec.json @@ -0,0 +1,22 @@ +[ + { + "operation": "shift", + "spec": { + "employees": { + "*": { + "@": "employees.@(1,id)" + } + } + } + }, + { + "operation": "remove", + "spec": { + "employees": { + "*": { + "id": "" + } + } + } + } +] \ No newline at end of file diff --git a/Problem14/input.json b/Problem14/input.json new file mode 100644 index 00000000..96bf3887 --- /dev/null +++ b/Problem14/input.json @@ -0,0 +1,34 @@ +{ + "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" + } + ] + } + ] +} \ No newline at end of file diff --git a/Problem14/output.json b/Problem14/output.json new file mode 100644 index 00000000..428cf26a --- /dev/null +++ b/Problem14/output.json @@ -0,0 +1,13 @@ +{ + "employees" : [ { + "id" : "001", + "name" : "John", + "department" : "HR", + "homePhone" : "555-555-1234" + }, { + "id" : "002", + "name" : "Jane", + "department" : "Sales", + "homePhone" : "555-555-4567" + } ] +} \ No newline at end of file diff --git a/Problem14/spec.json b/Problem14/spec.json new file mode 100644 index 00000000..317a6465 --- /dev/null +++ b/Problem14/spec.json @@ -0,0 +1,23 @@ +[ + { + "operation": "modify-default-beta", + "spec": { + "employees": { + "*": { + "homePhone": "@(1,phone[0].number)", + "workPhone": "@(1,number[1].number)" + } + } + } + }, + { + "operation": "remove", + "spec": { + "employees": { + "*": { + "phone": "" + } + } + } + } +] \ No newline at end of file diff --git a/Problem15/input.json b/Problem15/input.json new file mode 100644 index 00000000..13fe9386 --- /dev/null +++ b/Problem15/input.json @@ -0,0 +1,52 @@ +{ + "orders": [ + { + "id": "order1", + "date": "2022-01-01T00:00:00Z", + "customerId": "customer1", + "items": [ + { + "id": "item1", + "name": "Product 1", + "price": 10, + "quantity": 2 + }, + { + "id": "item2", + "name": "Product 2", + "price": 20, + "quantity": 1 + } + ], + "totalPrice": 40 + }, + { + "id": "order2", + "date": "2022-02-01T00:00:00Z", + "customerId": "customer1", + "items": [ + { + "id": "item3", + "name": "Product 3", + "price": 30, + "quantity": 3 + } + ], + "totalPrice": 90 + }, + { + "id": "order3", + "date": "2022-03-01T00:00:00Z", + "customerId": "customer2", + "items": [ + { + "id": "item4", + "name": "Product 4", + "price": 40, + "quantity": 4 + } + ], + "totalPrice": 160 + } + ] +} \ No newline at end of file diff --git a/Problem15/output.json b/Problem15/output.json new file mode 100644 index 00000000..372ca4a7 --- /dev/null +++ b/Problem15/output.json @@ -0,0 +1,45 @@ +{ + "customers" : [ { + "id" : "customer1", + "name" : "John Doe", + "orders" : [ { + "date" : "2022-01-01T00:00:00Z", + "id" : "order1", + "items" : [ { + "id" : "item1", + "name" : "Product 1", + "price" : 10, + "quantity" : 2 + }, { + "id" : "item2", + "name" : "Product 2", + "price" : 20, + "quantity" : 1 + } ] + }, { + "date" : "2022-02-01T00:00:00Z", + "id" : "order2", + "items" : [ { + "id" : "item3", + "name" : "Product 3", + "price" : 30, + "quantity" : 3 + } ] + } ], + "totalAmount" : 130 + }, { + "id" : "customer2", + "name" : "Jane Doe", + "orders" : [ { + "date" : "2022-03-01T00:00:00Z", + "id" : "order3", + "items" : [ { + "id" : "item4", + "name" : "Product 4", + "price" : 40, + "quantity" : 4 + } ] + } ], + "totalAmount" : 160 + } ] +} \ No newline at end of file diff --git a/Problem15/spec.json b/Problem15/spec.json new file mode 100644 index 00000000..d1a3e59a --- /dev/null +++ b/Problem15/spec.json @@ -0,0 +1,68 @@ + +[ + { + "operation": "shift", + "spec": { + "orders": { + "*": { + "@": "@(1,customerId).orders[]" + } + } + } + }, + { + "operation": "shift", + "spec": { + "*": "customers" + } + }, + { + "operation": "shift", + "spec": { + "customers": { + "*": { + "orders": { + "*": { + "*": "customers[#4].orders[#2].&", + "totalPrice": "customers[#4].totalAmount" + } + } + } + } + } + }, + { + "operation": "modify-overwrite-beta", + "spec": { + "customers": { + "*": { + "totalAmount": "=intSum(@(1,totalAmount))", + "id": "@(1,orders[0].customerId)" + }, + "[0]": { + "name": "John Doe" + }, + "[1]": { + "name": "Jane Doe" + } + } + } + }, + { + "operation": "remove", + "spec": { + "customers": { + "*": { + "orders": { + "*": { + "customerId": "" + } + } + } + } + } + }, + { + "operation": "sort" + } +] \ No newline at end of file diff --git a/Problem16/input.json b/Problem16/input.json new file mode 100644 index 00000000..81cde62d --- /dev/null +++ b/Problem16/input.json @@ -0,0 +1,30 @@ +{ + "employees": [ + { + "id": "1001", + "name": "John Doe", + "age": 25, + "skills": [ + { + "name": "Java", + "level": "Intermediate" + }, + { + "name": "Python", + "level": "Expert" + } + ] + }, + { + "id": "1002", + "name": "Jane Doe", + "age": 30, + "skills": [ + { + "name": "Java", + "level": "Expert" + } + ] + } + ] +} \ No newline at end of file diff --git a/Problem16/output.json b/Problem16/output.json new file mode 100644 index 00000000..3c72a2eb --- /dev/null +++ b/Problem16/output.json @@ -0,0 +1,16 @@ +{ + "Java": { + "Intermediate": [ + "John Doe" + ], + "Expert": [ + "Jane Doe", + "John Doe" + ] + }, + "Python": { + "Expert": [ + "John Doe" + ] + } +} \ No newline at end of file diff --git a/Problem16/spec.json b/Problem16/spec.json new file mode 100644 index 00000000..e69de29b diff --git a/Problem17/input.json b/Problem17/input.json new file mode 100644 index 00000000..32c93f05 --- /dev/null +++ b/Problem17/input.json @@ -0,0 +1,21 @@ +{ + "products": [ + { + "id": "1001", + "name": "Product 1", + "price": 10.99 + }, + { + "id": "1002", + "name": "Product 2", + "price": 15.99, + "available": true + }, + { + "id": "1003", + "name": "Product 3", + "price": 20.99, + "available": false + } + ] +} \ No newline at end of file diff --git a/Problem17/output.json b/Problem17/output.json new file mode 100644 index 00000000..39032689 --- /dev/null +++ b/Problem17/output.json @@ -0,0 +1,18 @@ +{ + "products" : [ { + "id" : "1001", + "name" : "Product 1", + "price" : 10.99, + "available" : false + }, { + "id" : "1002", + "name" : "Product 2", + "price" : 15.99, + "available" : true + }, { + "id" : "1003", + "name" : "Product 3", + "price" : 20.99, + "available" : false + } ] +} diff --git a/Problem17/spec.json b/Problem17/spec.json new file mode 100644 index 00000000..05db0d93 --- /dev/null +++ b/Problem17/spec.json @@ -0,0 +1,12 @@ +[ + { + "operation": "modify-default-beta", + "spec": { + "products": { + "*": { + "available": "false" + } + } + } + } +] \ No newline at end of file diff --git a/Problem18/input.json b/Problem18/input.json new file mode 100644 index 00000000..8250f2e3 --- /dev/null +++ b/Problem18/input.json @@ -0,0 +1,19 @@ +{ + "employees": [ + { + "name": "John", + "age": 30, + "salary": 5000 + }, + { + "name": "Jane", + "age": 35, + "salary": 6000 + }, + { + "name": "Bob", + "age": 40, + "salary": 7000 + } + ] +} \ No newline at end of file diff --git a/Problem18/output.json b/Problem18/output.json new file mode 100644 index 00000000..7634908f --- /dev/null +++ b/Problem18/output.json @@ -0,0 +1,15 @@ +{ + "employees" : [ { + "name" : "John", + "age" : 30, + "salary" : 5500 + }, { + "name" : "Jane", + "age" : 35, + "salary" : 6600 + }, { + "name" : "Bob", + "age" : 40, + "salary" : 7700 + } ] +} \ No newline at end of file diff --git a/Problem18/spec.json b/Problem18/spec.json new file mode 100644 index 00000000..e65dbe48 --- /dev/null +++ b/Problem18/spec.json @@ -0,0 +1,23 @@ +[ + { + "operation": "modify-overwrite-beta", + "spec": { + "employees": { + "*": { + "incrementby": "=divide(@(1,salary),10)", + "salary": "=intSum(@(1,salary),@(1,incrementby))" + } + } + } + }, + { + "operation": "remove", + "spec": { + "employees": { + "*": { + "incrementby": "" + } + } + } + } +] \ No newline at end of file diff --git a/Problem19/input.json b/Problem19/input.json new file mode 100644 index 00000000..55e3d6fa --- /dev/null +++ b/Problem19/input.json @@ -0,0 +1,19 @@ +{ + "products": [ + { + "id": "1001", + "name": "Product 1", + "price": 10.99 + }, + { + "id": "1002", + "name": "Product 2", + "price": 15.99 + }, + { + "id": "1003", + "name": "Product 3", + "price": 20.99 + } + ] +} \ No newline at end of file diff --git a/Problem19/output.json b/Problem19/output.json new file mode 100644 index 00000000..ca9db584 --- /dev/null +++ b/Problem19/output.json @@ -0,0 +1,15 @@ +{ + "products" : [ { + "id" : "1001", + "name" : "Product 1", + "price" : 10.99 + }, { + "id" : "1002", + "name" : "Product 2", + "ans" : 31.98 + }, { + "id" : "1003", + "name" : "Product 3", + "ans" : 41.98 + } ] +} \ No newline at end of file diff --git a/Problem19/spec.json b/Problem19/spec.json new file mode 100644 index 00000000..f72a95c9 --- /dev/null +++ b/Problem19/spec.json @@ -0,0 +1,31 @@ +[ + + { + "operation": "modify-overwrite-beta", + "spec": { + "products": { + "*": { + "mul": "=divide(1,2)", + "ans": "=divide(@(1,price),@(1,mul))" + } + } + } + }, + { + "operation": "shift", + "spec": { + "products": { + "0": { + "id": "products.[&1].&", + "name": "products.[&1].&", + "price": "products.[&1].&" + }, + "*": { + "id": "products.[&1].&", + "name": "products.[&1].&", + "ans": "products.[&1].&" + } + } + } + } +] \ No newline at end of file diff --git a/Problem2/input.json b/Problem2/input.json new file mode 100644 index 00000000..fac68ff3 --- /dev/null +++ b/Problem2/input.json @@ -0,0 +1,5 @@ +{ + "name": "John", + "age": 35, + "city": "New York" +} \ No newline at end of file diff --git a/Problem2/output.json b/Problem2/output.json new file mode 100644 index 00000000..c03d87c2 --- /dev/null +++ b/Problem2/output.json @@ -0,0 +1,5 @@ +{ + "Name" : "John", + "Age" : 35, + "City" : "New York" +} \ No newline at end of file diff --git a/Problem2/spec.json b/Problem2/spec.json new file mode 100644 index 00000000..4d9911d8 --- /dev/null +++ b/Problem2/spec.json @@ -0,0 +1,10 @@ +[ + { + "operation": "shift", + "spec": { + "name": "Name", + "age": "Age", + "city": "City" + } + } +] \ No newline at end of file diff --git a/Problem21/input.json b/Problem21/input.json new file mode 100644 index 00000000..e8d3eaad --- /dev/null +++ b/Problem21/input.json @@ -0,0 +1,10 @@ +{ + "restaurant": { + "rating": { + "value": 3 + }, + "address": { + "value": "India" + } + } +} \ No newline at end of file diff --git a/Problem21/output.json b/Problem21/output.json new file mode 100644 index 00000000..9eea5e84 --- /dev/null +++ b/Problem21/output.json @@ -0,0 +1,4 @@ +//output +{ + "Restaurant Rating" : 3 +} \ No newline at end of file diff --git a/Problem21/spec.json b/Problem21/spec.json new file mode 100644 index 00000000..4f90e98d --- /dev/null +++ b/Problem21/spec.json @@ -0,0 +1,12 @@ +[ + { + "operation": "shift", + "spec": { + "restaurant": { + "rating": { + "value": "Restaurant Rating" + } + } + } + } +] \ No newline at end of file diff --git a/Problem22/input.json b/Problem22/input.json new file mode 100644 index 00000000..8233d340 --- /dev/null +++ b/Problem22/input.json @@ -0,0 +1,22 @@ +[ + { + "restaurant": { + "rating": { + "value": 9 + }, + "address": { + "value": "India" + } + } + }, + { + "restaurant": { + "rating": { + "value": 7 + }, + "address": { + "value": "United States" + } + } + } +] \ No newline at end of file diff --git a/Problem22/output.json b/Problem22/output.json new file mode 100644 index 00000000..c9e8c392 --- /dev/null +++ b/Problem22/output.json @@ -0,0 +1,5 @@ +[ { + "Restaurant Rating" : 9 +}, { + "Restaurant Rating" : 7 +} ] \ No newline at end of file diff --git a/Problem22/spec.json b/Problem22/spec.json new file mode 100644 index 00000000..4b92aeaa --- /dev/null +++ b/Problem22/spec.json @@ -0,0 +1,14 @@ +[ + { + "operation": "shift", + "spec": { + "*": { + "restaurant": { + "rating": { + "value": "[&3].Restaurant Rating" + } + } + } + } + } +] \ No newline at end of file diff --git a/Problem23/input.json b/Problem23/input.json new file mode 100644 index 00000000..8233d340 --- /dev/null +++ b/Problem23/input.json @@ -0,0 +1,22 @@ +[ + { + "restaurant": { + "rating": { + "value": 9 + }, + "address": { + "value": "India" + } + } + }, + { + "restaurant": { + "rating": { + "value": 7 + }, + "address": { + "value": "United States" + } + } + } +] \ No newline at end of file diff --git a/Problem23/output.json b/Problem23/output.json new file mode 100644 index 00000000..4d9862bc --- /dev/null +++ b/Problem23/output.json @@ -0,0 +1,7 @@ +[ { + "Restaurant Rating" : 9, + "Restaurant Country" : "India" +}, { + "Restaurant Rating" : 7, + "Restaurant Country" : "United States" +} ] \ No newline at end of file diff --git a/Problem23/spec.json b/Problem23/spec.json new file mode 100644 index 00000000..5856c30d --- /dev/null +++ b/Problem23/spec.json @@ -0,0 +1,17 @@ +[ + { + "operation": "shift", + "spec": { + "*": { + "restaurant": { + "rating": { + "value": "[&3].Restaurant Rating" + }, + "address": { + "value": "[&3].Restaurant Country" + } + } + } + } + } +] \ No newline at end of file diff --git a/Problem24/input.json b/Problem24/input.json new file mode 100644 index 00000000..3d92b76b --- /dev/null +++ b/Problem24/input.json @@ -0,0 +1,42 @@ +[ + { + "restaurant": { + "rating": { + "value": 9 + }, + "address": { + "value": "India" + } + }, + "itemsList": [ + { + "itemName": "Example 11", + "itemPrice": 120 + }, + { + "itemName": "Example 12", + "itemPrice": 150 + } + ] + }, + { + "restaurant": { + "rating": { + "value": 7 + }, + "address": { + "value": "United States" + } + }, + "itemsList": [ + { + "itemName": "Example 21", + "itemPrice": 100 + }, + { + "itemName": "Example 22", + "itemPrice": 190 + } + ] + } +] \ No newline at end of file diff --git a/Problem24/output.json b/Problem24/output.json new file mode 100644 index 00000000..abfa7bf6 --- /dev/null +++ b/Problem24/output.json @@ -0,0 +1,11 @@ +[ { + "Restaurant Rating" : 9, + "Restaurant Country" : "India", + "Dish Name" : [ "Example 11", "Example 12" ], + "Dish Price" : [ 120, 150 ] +}, { + "Restaurant Rating" : 7, + "Restaurant Country" : "United States", + "Dish Name" : [ "Example 21", "Example 22" ], + "Dish Price" : [ 100, 190 ] +} ] diff --git a/Problem24/spec.json b/Problem24/spec.json new file mode 100644 index 00000000..3a7081e0 --- /dev/null +++ b/Problem24/spec.json @@ -0,0 +1,23 @@ +[ + { + "operation": "shift", + "spec": { + "*": { + "restaurant": { + "rating": { + "value": "[&3].Restaurant Rating" + }, + "address": { + "value": "[&3].Restaurant Country" + } + }, + "itemsList": { + "*": { + "itemName": "[&3].Dish Name", + "itemPrice": "[&3].Dish Price" + } + } + } + } + } +] \ No newline at end of file diff --git a/Problem25/input.json b/Problem25/input.json new file mode 100644 index 00000000..3d92b76b --- /dev/null +++ b/Problem25/input.json @@ -0,0 +1,42 @@ +[ + { + "restaurant": { + "rating": { + "value": 9 + }, + "address": { + "value": "India" + } + }, + "itemsList": [ + { + "itemName": "Example 11", + "itemPrice": 120 + }, + { + "itemName": "Example 12", + "itemPrice": 150 + } + ] + }, + { + "restaurant": { + "rating": { + "value": 7 + }, + "address": { + "value": "United States" + } + }, + "itemsList": [ + { + "itemName": "Example 21", + "itemPrice": 100 + }, + { + "itemName": "Example 22", + "itemPrice": 190 + } + ] + } +] \ No newline at end of file diff --git a/Problem25/output.json b/Problem25/output.json new file mode 100644 index 00000000..ecffb1de --- /dev/null +++ b/Problem25/output.json @@ -0,0 +1,21 @@ +[ { + "Restaurant Rating" : 9, + "Restaurant Country" : "India", + "Dishes" : [ { + "Dish Name" : "Example 11", + "Dish Price" : 120 + }, { + "Dish Name" : "Example 12", + "Dish Price" : 150 + } ] +}, { + "Restaurant Rating" : 7, + "Restaurant Country" : "United States", + "Dishes" : [ { + "Dish Name" : "Example 21", + "Dish Price" : 100 + }, { + "Dish Name" : "Example 22", + "Dish Price" : 190 + } ] +} ] diff --git a/Problem25/spec.json b/Problem25/spec.json new file mode 100644 index 00000000..85f9efac --- /dev/null +++ b/Problem25/spec.json @@ -0,0 +1,23 @@ +[ + { + "operation": "shift", + "spec": { + "*": { + "restaurant": { + "rating": { + "value": "[&3].Restaurant Rating" + }, + "address": { + "value": "[&3].Restaurant Country" + } + }, + "itemsList": { + "*": { + "itemName": "[&3].Dishes.[&1].Dish Name", + "itemPrice": "[&3].Dishes.[&1].Dish Price" + } + } + } + } + } +] \ No newline at end of file diff --git a/Problem26/input.json b/Problem26/input.json new file mode 100644 index 00000000..92b6051c --- /dev/null +++ b/Problem26/input.json @@ -0,0 +1,14 @@ +[ + { + "returnId": "10051", + "returnQuantity": 2, + "returnPrice": 100, + "returnTax": 12.56 + }, + { + "returnId": "10052", + "returnQuantity": 25, + "returnPrice": 35, + "returnTax": 29.85 + } +] \ No newline at end of file diff --git a/Problem26/output.json b/Problem26/output.json new file mode 100644 index 00000000..7e22294b --- /dev/null +++ b/Problem26/output.json @@ -0,0 +1,9 @@ +[ { + "returnId" : "10051", + "Return Amount" : 200.0, + "Return Total Amount" : 212.56 +}, { + "returnId" : "10052", + "Return Amount" : 875.0, + "Return Total Amount" : 904.85 +} ] diff --git a/Problem26/spec.json b/Problem26/spec.json new file mode 100644 index 00000000..d6a95d8f --- /dev/null +++ b/Problem26/spec.json @@ -0,0 +1,24 @@ +[ + { + "operation": "modify-overwrite-beta", + "spec": { + "*": { + "returnId": "@(1,Return Id)", + "inverse": "=divide(1, @(1,returnPrice))", + "Return Amount": "=divideAndRound(2, @(1,returnQuantity), @(1,inverse))", + "Return Total Amount": "=doubleSum(@(1,returnTax),@(1,Return Amount))" + } + } + }, + { + "operation": "remove", + "spec": { + "*": { + "returnQuantity": "", + "returnPrice": "", + "returnTax": "", + "inverse": "" + } + } + } +] \ No newline at end of file diff --git a/Problem27/input.json b/Problem27/input.json new file mode 100644 index 00000000..6cf0a9cf --- /dev/null +++ b/Problem27/input.json @@ -0,0 +1,23 @@ +[ + { + "returnId": "10051", + "returnQuantity": 2, + "returnPrice": 100, + "returnTax": 12.56, + "country": "USA" + }, + { + "returnId": "10052", + "returnQuantity": 25, + "returnPrice": 35, + "returnTax": 29.85, + "country": "CA" + }, + { + "returnId": "10053", + "returnQuantity": 5, + "returnPrice": 55, + "returnTax": 9.85, + "country": "" + } +] \ No newline at end of file diff --git a/Problem27/output.json b/Problem27/output.json new file mode 100644 index 00000000..ce1c3f88 --- /dev/null +++ b/Problem27/output.json @@ -0,0 +1,16 @@ +[ { + "Return Id" : "10051", + "Return Amount" : 200.0, + "Return Total Amount" : 212.56, + "Country" : "United States of America" +}, { + "Return Id" : "10052", + "Return Amount" : 875.0, + "Return Total Amount" : 904.85, + "Country" : "Canada" +}, { + "Return Id" : "10053", + "Return Amount" : 275.0, + "Return Total Amount" : 284.85, + "Country" : "NA" +} ] \ No newline at end of file diff --git a/Problem27/spec.json b/Problem27/spec.json new file mode 100644 index 00000000..cd13b2e4 --- /dev/null +++ b/Problem27/spec.json @@ -0,0 +1,42 @@ +[ + { + "operation": "modify-overwrite-beta", + "spec": { + "*": { + "quantity": "=divide(1,@(1,returnQuantity))", + "returnPrice": "=divide(@(1,returnPrice),@(1,quantity))", + "returnTotal": "@(1,returnPrice)" + } + } + }, + { + "operation": "shift", + "spec": { + "*": { + "returnId": "[&1].Return Id", + "returnPrice": "[&1].Return Amount", + "returnTax": "[&1].Return Total Amount[]", + "returnTotal": "[&1].Return Total Amount[]", + "country": { + "USA": { + "#United States of America": "[&3].Country" + }, + "CA": { + "#Canada": "[&3].Country" + }, + "*": { + "#NA": "[&3].Country" + } + } + } + } + }, + { + "operation": "modify-overwrite-beta", + "spec": { + "*": { + "Return Total Amount": "=doubleSum(@(1,Return Total Amount))" + } + } + } + ] \ No newline at end of file diff --git a/Problem28/input.json b/Problem28/input.json new file mode 100644 index 00000000..ebddd1cf --- /dev/null +++ b/Problem28/input.json @@ -0,0 +1,45 @@ +[ + { + "returnId": "151", + "returnItemAdjustments": [ + { + "returnItemSeqId": "00001", + "amount": 28.64, + "returnAdjustmentTypeId": "RET_SALES_TAX_ADJ", + "description": "Return Sales Tax", + "createdDate": null, + "returnId": "151", + "returnAdjustmentId": "", + "comments": "Return Sales Tax", + "shipGroupSeqId": null + }, + { + "returnItemSeqId": "00001", + "amount": 58.64, + "returnAdjustmentTypeId": "RET_SALES_TAX_ADJ", + "description": "Return Sales Tax", + "createdDate": null, + "returnId": "151", + "returnAdjustmentId": "", + "comments": "Return Sales Tax", + "shipGroupSeqId": null + } + ] + }, + { + "returnId": "152", + "returnItemAdjustments": [ + { + "returnItemSeqId": "00002", + "amount": 38.64, + "returnAdjustmentTypeId": "RET_SALES_TAX_ADJ", + "description": "Return Sales Tax", + "createdDate": null, + "returnId": "152", + "returnAdjustmentId": "", + "comments": "Return Sales Tax", + "shipGroupSeqId": null + } + ] + } +] \ No newline at end of file diff --git a/Problem28/output.json b/Problem28/output.json new file mode 100644 index 00000000..1372e73d --- /dev/null +++ b/Problem28/output.json @@ -0,0 +1,7 @@ +[ { + "returnId" : "151", + "returnTax" : 87.28 +}, { + "returnId" : "152", + "returnTax" : 38.64 +} ] \ No newline at end of file diff --git a/Problem28/spec.json b/Problem28/spec.json new file mode 100644 index 00000000..f756e00d --- /dev/null +++ b/Problem28/spec.json @@ -0,0 +1,23 @@ +[ + { + "operation": "shift", + "spec": { + "*": { + "*": "[&1].returnId", + "returnItemAdjustments": { + "*": { + "amount": "[&3].returnTax" + } + } + } + } + }, + { + "operation": "modify-overwrite-beta", + "spec": { + "*": { + "returnTax": "=doubleSum(@(1,returnTax))" + } + } + } +] \ No newline at end of file diff --git a/Problem29/input.json b/Problem29/input.json new file mode 100644 index 00000000..8caa5038 --- /dev/null +++ b/Problem29/input.json @@ -0,0 +1,10 @@ +{ + "person": { + "name": "John Doe", + "age": 30, + "address": { + "city": "New York", + "state": "NY" + } + } +} \ No newline at end of file diff --git a/Problem29/output.json b/Problem29/output.json new file mode 100644 index 00000000..37b17f13 --- /dev/null +++ b/Problem29/output.json @@ -0,0 +1,6 @@ +{ + "person_name" : "John Doe", + "person_age" : 30, + "person_address_city" : "New York", + "person_address_state" : "NY" +} \ No newline at end of file diff --git a/Problem29/spec.json b/Problem29/spec.json new file mode 100644 index 00000000..c013d509 --- /dev/null +++ b/Problem29/spec.json @@ -0,0 +1,15 @@ +[ + { + "operation": "shift", + "spec": { + "person": { + "name": "person_name", + "age": "person_age", + "address": { + "city": "person_address_city", + "state": "person_address_state" + } + } + } + } +] \ No newline at end of file diff --git a/Problem3/input.json b/Problem3/input.json new file mode 100644 index 00000000..ea4fd60e --- /dev/null +++ b/Problem3/input.json @@ -0,0 +1,6 @@ +{ + "name": "John", + "age": 35, + "city": "New York", + "phone": "+1-555-123-4567" +} \ No newline at end of file diff --git a/Problem3/output.json b/Problem3/output.json new file mode 100644 index 00000000..265e81b6 --- /dev/null +++ b/Problem3/output.json @@ -0,0 +1,8 @@ +{ + "Name" : "John", + "Age" : 35, + "Contact" : { + "City" : "New York", + "Phone" : "+1-555-123-4567" + } +} \ No newline at end of file diff --git a/Problem3/spec.json b/Problem3/spec.json new file mode 100644 index 00000000..9e2bcebb --- /dev/null +++ b/Problem3/spec.json @@ -0,0 +1,11 @@ +[ + { + "operation": "shift", + "spec": { + "name": "Name", + "age": "Age", + "city": "Contact.City", + "phone": "Contact.Phone" + } + } +] \ No newline at end of file diff --git a/Problem30/input.json b/Problem30/input.json new file mode 100644 index 00000000..b316516b --- /dev/null +++ b/Problem30/input.json @@ -0,0 +1,18 @@ +{ + "person": { + "name": "John Doe", + "age": 30, + "address": { + "city": "New York", + "state": "NY" + } + }, + "employee": { + "name": "Jane Doe", + "salary": 50000, + "office": { + "city": "San Francisco", + "state": "CA" + } + } +} \ No newline at end of file diff --git a/Problem30/output.json b/Problem30/output.json new file mode 100644 index 00000000..991a9f7c --- /dev/null +++ b/Problem30/output.json @@ -0,0 +1,5 @@ +{ + "name" : "John Doe", + "office_city" : "San Francisco", + "office_state" : "CA" +} \ No newline at end of file diff --git a/Problem30/spec.json b/Problem30/spec.json new file mode 100644 index 00000000..6bc650df --- /dev/null +++ b/Problem30/spec.json @@ -0,0 +1,16 @@ +[ + { + "operation": "shift", + "spec": { + "person": { + "name": "name" + }, + "employee": { + "office": { + "city": "office_city", + "state": "office_state" + } + } + } + } +] \ No newline at end of file diff --git a/Problem31/input.json b/Problem31/input.json new file mode 100644 index 00000000..5fe554de --- /dev/null +++ b/Problem31/input.json @@ -0,0 +1,21 @@ +//input +{ + "items": [ + { + "id": "1", + "name": "Book", + "prices": [ + {"currency": "USD", "value": 10}, + {"currency": "EUR", "value": 8} + ] + }, + { + "id": "2", + "name": "Pen", + "prices": [ + {"currency": "USD", "value": 2}, + {"currency": "EUR", "value": 1.5} + ] + } + ] +} \ No newline at end of file diff --git a/Problem31/output.json b/Problem31/output.json new file mode 100644 index 00000000..5bb96a4f --- /dev/null +++ b/Problem31/output.json @@ -0,0 +1,6 @@ +{ + "1_USD" : 10, + "1_EUR" : 8, + "2_USD" : 2, + "2_EUR" : 1.5 +} \ No newline at end of file diff --git a/Problem31/spec.json b/Problem31/spec.json new file mode 100644 index 00000000..fa527742 --- /dev/null +++ b/Problem31/spec.json @@ -0,0 +1,31 @@ +// 31 +[ + { + "operation": "modify-overwrite-beta", + "spec": { + "items": { + "*": { + "prices": { + "*": { + "currency": "=concat(@(3,id),'_',@(1,currency))" + } + } + } + } + } + }, + { + "operation": "shift", + "spec": { + "items": { + "*": { + "prices": { + "*": { + "value": "@(1,currency)" + } + } + } + } + } + } +] \ No newline at end of file diff --git a/Problem32/input.json b/Problem32/input.json new file mode 100644 index 00000000..a4a10c52 --- /dev/null +++ b/Problem32/input.json @@ -0,0 +1,24 @@ +{ + "data": [ + { + "x": "A", + "y": "1", + "value": 10 + }, + { + "x": "A", + "y": "2", + "value": 20 + }, + { + "x": "B", + "y": "1", + "value": 30 + }, + { + "x": "B", + "y": "2", + "value": 40 + } + ] +} \ No newline at end of file diff --git a/Problem32/output.json b/Problem32/output.json new file mode 100644 index 00000000..cab664a2 --- /dev/null +++ b/Problem32/output.json @@ -0,0 +1,10 @@ +{ + "A" : { + "1" : 10, + "2" : 20 + }, + "B" : { + "1" : 30, + "2" : 40 + } +} diff --git a/Problem32/spec.json b/Problem32/spec.json new file mode 100644 index 00000000..a82c53a3 --- /dev/null +++ b/Problem32/spec.json @@ -0,0 +1,12 @@ +[ + { + "operation": "shift", + "spec": { + "data": { + "*": { + "@(value)": "@(1,x).@(1,y)" + } + } + } + } +] \ No newline at end of file diff --git a/Problem33/input.json b/Problem33/input.json new file mode 100644 index 00000000..bb036032 --- /dev/null +++ b/Problem33/input.json @@ -0,0 +1,14 @@ +{ + "id": 1, + "name": "John", + "hobbies": [ + { + "name": "reading", + "level": "advanced" + }, + { + "name": "swimming", + "level": "beginner" + } + ] +} \ No newline at end of file diff --git a/Problem33/output.json b/Problem33/output.json new file mode 100644 index 00000000..09267d29 --- /dev/null +++ b/Problem33/output.json @@ -0,0 +1,11 @@ +[ { + "id" : 1, + "name" : "John", + "hobby_name" : "reading", + "hobby_level" : "advanced" +}, { + "id" : 1, + "name" : "John", + "hobby_name" : "swimming", + "hobby_level" : "beginner" +} ] diff --git a/Problem33/spec.json b/Problem33/spec.json new file mode 100644 index 00000000..e2896354 --- /dev/null +++ b/Problem33/spec.json @@ -0,0 +1,15 @@ +[ + { + "operation": "shift", + "spec": { + "hobbies": { + "*": { + "@(2,id)": "[#2].id", + "@(2,name)": "[#2].name", + "name": "[#2].hobby_name", + "level": "[#2].hobby_level" + } + } + } + } + ] \ No newline at end of file diff --git a/Problem34/input.json b/Problem34/input.json new file mode 100644 index 00000000..fd2c8cb2 --- /dev/null +++ b/Problem34/input.json @@ -0,0 +1,7 @@ +{ + "name": "John", + "hobby_1": "reading", + "level_1": "advanced", + "hobby_2": "swimming", + "level_2": "beginner" +} \ No newline at end of file diff --git a/Problem34/output.json b/Problem34/output.json new file mode 100644 index 00000000..b024ec11 --- /dev/null +++ b/Problem34/output.json @@ -0,0 +1,10 @@ +{ + "name" : "John", + "hobbies" : [ { + "name" : "reading", + "level" : "advanced" + }, { + "name" : "swimming", + "level" : "beginner" + } ] +} diff --git a/Problem34/spec.json b/Problem34/spec.json new file mode 100644 index 00000000..311dbcaf --- /dev/null +++ b/Problem34/spec.json @@ -0,0 +1,16 @@ +[ + { + "operation": "shift", + "spec": { + "name": "&", + "hobby_1": { + "@(2,hobby_1)": "hobbies[0].name", + "@(2,level_1)": "hobbies[0].level" + }, + "hobby_2": { + "@(2,hobby_2)": "hobbies[1].name", + "@(2,level_2)": "hobbies[1].level" + } + } + } + ] \ No newline at end of file diff --git a/Problem4/input.json b/Problem4/input.json new file mode 100644 index 00000000..aaa93dcf --- /dev/null +++ b/Problem4/input.json @@ -0,0 +1,9 @@ +{ + "name": "John", + "age": 35, + "hobbies": [ + "reading", + "movies", + "travel" + ] +} \ No newline at end of file diff --git a/Problem4/output.json b/Problem4/output.json new file mode 100644 index 00000000..1c91cadd --- /dev/null +++ b/Problem4/output.json @@ -0,0 +1,15 @@ +{ + "Name": "John", + "Age": 35, + "Hobbies": [ + { + "Name": "reading" + }, + { + "Name": "movies" + }, + { + "Name": "travel" + } + ] +} \ No newline at end of file diff --git a/Problem4/spec.json b/Problem4/spec.json new file mode 100644 index 00000000..828dcfdc --- /dev/null +++ b/Problem4/spec.json @@ -0,0 +1,14 @@ +[ + { + "operation": "shift", + "spec": { + "name": "Name", + "age": "Age", + "hobbies": { + "*": { + "@": " Hobbies[#2].Name" + } + } + } + } +] \ No newline at end of file diff --git a/Problem5/input.json b/Problem5/input.json new file mode 100644 index 00000000..dfad17cf --- /dev/null +++ b/Problem5/input.json @@ -0,0 +1,11 @@ +{ + "firstName": "John", + "lastName": "Doe", + "email": "johndoe@example.com", + "address": { + "street": "123 Main St", + "city": "Anytown", + "state": "CA", + "zip": "12345" + } +} \ No newline at end of file diff --git a/Problem5/output.json b/Problem5/output.json new file mode 100644 index 00000000..9a18d1a9 --- /dev/null +++ b/Problem5/output.json @@ -0,0 +1,6 @@ +{ + " email" : "johndoe@example.com", + "city" : "Anytown", + "zip" : "12345", + "fullName" : "John Doe" +} \ No newline at end of file diff --git a/Problem5/spec.json b/Problem5/spec.json new file mode 100644 index 00000000..448aa4ba --- /dev/null +++ b/Problem5/spec.json @@ -0,0 +1,20 @@ +[ + + { + "operation": "modify-default-beta", + "spec": { + "fullName": "=concat(@(1,firstName),' ',@(1,lastName))" + } + }, + { + "operation": "shift", + "spec": { + "fullName": "fullName", + "email": " email", + "*": { + "city": "city", + "zip": "zip" + } + } + } +] \ No newline at end of file diff --git a/Problem6/input.json b/Problem6/input.json new file mode 100644 index 00000000..01af5fd7 --- /dev/null +++ b/Problem6/input.json @@ -0,0 +1,44 @@ +{ + "users": [ + { + "name": "John Doe", + "age": 35, + "address": { + "street": "123 Main St", + "city": "Anytown", + "state": "CA", + "zip": "12345" + }, + "hobbies": [ + { + "name": "reading", + "type": "indoor" + }, + { + "name": "hiking", + "type": "outdoor" + } + ] + }, + { + "name": "Jane Doe", + "age": 30, + "address": { + "street": "456 First St", + "city": "Othertown", + "state": "NY", + "zip": "67890" + }, + "hobbies": [ + { + "name": "swimming", + "type": "outdoor" + }, + { + "name": "painting", + "type": "indoor" + } + ] + } + ] +} \ No newline at end of file diff --git a/Problem6/output.json b/Problem6/output.json new file mode 100644 index 00000000..55f85e2f --- /dev/null +++ b/Problem6/output.json @@ -0,0 +1,9 @@ +[ { + "Name" : "John Doe", + "Address" : "123 Main St, Anytown, CA 12345", + "Hobbies" : [ "reading", "hiking" ] +}, { + "Name" : "Jane Doe", + "Address" : "456 First St, Othertown, NY 67890", + "Hobbies" : [ "swimming", "painting" ] +} ] \ No newline at end of file diff --git a/Problem6/spec.json b/Problem6/spec.json new file mode 100644 index 00000000..468bddf7 --- /dev/null +++ b/Problem6/spec.json @@ -0,0 +1,27 @@ +[ + { + "operation": "modify-overwrite-beta", + "spec": { + "users": { + "*": { + "address": "=concat(@(0,street),', ',@(0,city),', ',@(0,state),' ',@(0,zip))" + } + } + } + }, { + "operation": "shift", + "spec": { + "users": { + "*": { + "name": "[&1].Name", + "address": "[&1].Address", + "hobbies": { + "*": { + "name": "[#4].Hobbies" + } + } + } + } + } + } +] \ No newline at end of file diff --git a/Problem7/input.json b/Problem7/input.json new file mode 100644 index 00000000..c603120a --- /dev/null +++ b/Problem7/input.json @@ -0,0 +1,14 @@ +{ + "students": [ + { + "name": "John Doe", + "age": 23, + "email": "john.doe@example.com" + }, + { + "name": "Jane Smith", + "age": 25, + "email": "jane.smith@example.com" + } + ] +} \ No newline at end of file diff --git a/Problem7/output.json b/Problem7/output.json new file mode 100644 index 00000000..b0f7ea3a --- /dev/null +++ b/Problem7/output.json @@ -0,0 +1,11 @@ +[ { + "Name": "John Doe", + "Age": 23, + "Domain": "example.com" + }, + { + "Name": "Jane Smith", + "Age": 25, + "Domain": "example.com" + } +] \ No newline at end of file diff --git a/Problem7/spec.json b/Problem7/spec.json new file mode 100644 index 00000000..77d748d5 --- /dev/null +++ b/Problem7/spec.json @@ -0,0 +1,25 @@ +[ + { + "operation": "modify-overwrite-beta", + "spec": { + "students": { + "*": { + "email": "=split('@',@(1,email))", + "domain": "=lastElement(@(1,email))" + } + } + } + }, + { + "operation": "shift", + "spec": { + "students": { + "*": { + "name": "[&1].Name", + "age": "[&1].Age", + "domain": "[&1].Domain" + } + } + } + } +] \ No newline at end of file diff --git a/Problem8/input.json b/Problem8/input.json new file mode 100644 index 00000000..f1fd0227 --- /dev/null +++ b/Problem8/input.json @@ -0,0 +1,17 @@ +{ + "employees": [ + { + "name": "John Doe", + "salary": 50000, + "department": "Sales" + }, + { + "name": "Jane Smith", + "salary": 60000 + }, + { + "name": "Bob Johnson", + "department": "IT" + } + ] +} \ No newline at end of file diff --git a/Problem8/output.json b/Problem8/output.json new file mode 100644 index 00000000..07cd60fb --- /dev/null +++ b/Problem8/output.json @@ -0,0 +1,19 @@ +{ + "employees" : [ { + "name" : "John Doe", + "salary" : 50000, + "department" : "Sales", + "bonus" : 1000 + }, { + "name" : "Bob Johnson", + "salary" : 45000, + "department" : "IT", + "bonus" : 900 + }, { + "name" : "Jane Smith", + "salary" : 60000, + "department" : "Marketing", + "bonus" : 1500 + } ], + "totalBonus" : 3400.0 +} \ No newline at end of file diff --git a/Problem8/spec.json b/Problem8/spec.json new file mode 100644 index 00000000..77afebeb --- /dev/null +++ b/Problem8/spec.json @@ -0,0 +1,74 @@ +[ + { + "operation": "modify-default-beta", + "spec": { + "employees": { + "*": { + "department": "Marketing", + "salary": 45000 + } + } + } + } + , + { + "operation": "shift", + "spec": { + "employees": { + "*": { + "name": "employees.@(1,department).&", + "salary": "employees.@(1,department).&", + "department": "employees.@(1,department).&" + } + } + } + }, { + "operation": "modify-overwrite-beta", + "spec": { + "employees": { + "Sales|IT": { + "bonus": "=divideAndRound(2,@(1,salary), 50)" + }, + "Marketing": { + "bonus": "=divideAndRound(2,@(1,salary), 40)" + } + } + } + }, + { + "operation": "shift", + "spec": { + "employees": { + "Sales|IT": { + "*": "employees.[#2].&" + }, + "Marketing": { + "*": "employees.[#2].&" + } + } + } + }, + { + "operation": "shift", + "spec": { + "employees": { + "@": "&", + "*": { + "bonus": "totalBonus[]" + } + } + } + } + , + { + "operation": "modify-overwrite-beta", + "spec": { + "totalBonus": "=doubleSum(@(1,totalBonus))", + "employees": { + "*": { + "bonus": "=toInteger" + } + } + } + } +] \ No newline at end of file diff --git a/Problem9/input.json b/Problem9/input.json new file mode 100644 index 00000000..0556985b --- /dev/null +++ b/Problem9/input.json @@ -0,0 +1,10 @@ +{ + "name": "John", + "age": 30, + "address": { + "street": "123 Main St", + "city": "Anytown", + "state": "CA", + "zip": "12345" + } +} \ No newline at end of file diff --git a/Problem9/output.json b/Problem9/output.json new file mode 100644 index 00000000..002380ea --- /dev/null +++ b/Problem9/output.json @@ -0,0 +1,9 @@ +{ + "name": "John", + "age": 30, + "address": { + "street": "123 Main St", + "city": "Anytown", + "zip": "12345" + } +} \ No newline at end of file diff --git a/Problem9/spec.json b/Problem9/spec.json new file mode 100644 index 00000000..a5eb8738 --- /dev/null +++ b/Problem9/spec.json @@ -0,0 +1,10 @@ +[ + { + "operation": "remove", + "spec": { + "*": { + "state": "" + } + } + } +] \ No newline at end of file diff --git a/problem20/input.json b/problem20/input.json new file mode 100644 index 00000000..613d04ad --- /dev/null +++ b/problem20/input.json @@ -0,0 +1,28 @@ +{ + "employees": [ + { + "name": "John", + "age": 30, + "department": { + "id": 1, + "name": "Sales" + } + }, + { + "name": "Jane", + "age": 35, + "department": { + "id": 2, + "name": "Marketing" + } + }, + { + "name": "Bob", + "age": 40, + "department": { + "id": 1, + "name": "Sales" + } + } + ] +} \ No newline at end of file diff --git a/problem20/output.json b/problem20/output.json new file mode 100644 index 00000000..47af8c11 --- /dev/null +++ b/problem20/output.json @@ -0,0 +1,20 @@ +{ + "departments" : [ { + "id" : 1, + "name" : "Sales", + "employees" : [ { + "name" : "John", + "age" : 30 + }, { + "name" : "Bob", + "age" : 40 + } ] + }, { + "id" : 2, + "name" : "Marketing", + "employees" : [ { + "name" : "Jane", + "age" : 35 + } ] + } ] +} \ No newline at end of file diff --git a/problem20/spec.json b/problem20/spec.json new file mode 100644 index 00000000..8bde6150 --- /dev/null +++ b/problem20/spec.json @@ -0,0 +1,64 @@ +[ + { + "operation": "shift", + "spec": { + "employees": { + "*": { + "department": { + "id": "departments[#3].id", + "name": "departments[#3].name" + }, + "name": "departments[#2].employees.name", + "age": "departments[#2].employees.age" + } + } + } + }, + { + "operation": "shift", + "spec": { + "departments": { + "*": { + "@": "departments.@(1,id)[]" + } + } + } + }, + { + "operation": "shift", + "spec": { + "departments": { + "*": { + "*": { + "id": "departments.@(1,id).id", + "name": "departments.@(1,id).name", + "employees": "departments.@(1,id).employees[]" + } + } + } + } + }, + + { + "operation": "modify-overwrite-beta", + "spec": { + "departments": { + "*": { + "*": { + "employees": "&" + }, + "id": "@(1,id[0])", + "name": "@(1,name[0])" + } + } + } + }, + { + "operation": "shift", + "spec": { + "departments": { + "*": "departments" + } + } + } +] \ No newline at end of file From e265f8df67409665eb1b2e3539a1103daa1fa095 Mon Sep 17 00:00:00 2001 From: Kunal Date: Thu, 25 May 2023 15:44:14 +0530 Subject: [PATCH 02/12] Added the jolt transformation for Problem statement 1 --- Problem1/output.json | 10 ++-- Problem1/spec.json | 106 +++++++++++++++++++++++++++---------------- 2 files changed, 71 insertions(+), 45 deletions(-) diff --git a/Problem1/output.json b/Problem1/output.json index 6a4f0d27..75f263e5 100644 --- a/Problem1/output.json +++ b/Problem1/output.json @@ -12,14 +12,14 @@ "itemId" : 1, "name" : "Product A", "quantity" : 2, - "price" : 10 + "price" : 10.0 }, { "itemId" : 2, "name" : "Product B", "quantity" : 1, - "price" : 20 + "price" : 20.0 } ], - "total" : 40.0 + "newprice" : 40.0 }, { "orderId" : 2, "orderDate" : "2022-02-21T09:12:34Z", @@ -33,8 +33,8 @@ "itemId" : 3, "name" : "Product C", "quantity" : 3, - "price" : 15 + "price" : 15.0 } ], - "total" : 45.0 + "newprice" : 45.0 } ] } \ No newline at end of file diff --git a/Problem1/spec.json b/Problem1/spec.json index 6a4f0d27..e3f83901 100644 --- a/Problem1/spec.json +++ b/Problem1/spec.json @@ -1,40 +1,66 @@ -{ - "orders" : [ { - "orderId" : 1, - "orderDate" : "2022-02-20T12:34:56Z", - "customer" : { - "customerId" : 1, - "email" : "johndoe@example.com", - "address" : "123 Main St, Anytown, CA 12345", - "fullName" : "John Doe" - }, - "items" : [ { - "itemId" : 1, - "name" : "Product A", - "quantity" : 2, - "price" : 10 - }, { - "itemId" : 2, - "name" : "Product B", - "quantity" : 1, - "price" : 20 - } ], - "total" : 40.0 - }, { - "orderId" : 2, - "orderDate" : "2022-02-21T09:12:34Z", - "customer" : { - "customerId" : 2, - "email" : "janesmith@example.com", - "address" : "456 Oak St, Somewhere, NY 67890", - "fullName" : "Jane Smith" - }, - "items" : [ { - "itemId" : 3, - "name" : "Product C", - "quantity" : 3, - "price" : 15 - } ], - "total" : 45.0 - } ] -} \ No newline at end of file +[ + { + "operation": "modify-overwrite-beta", + "spec": { + "orders": { + "*": { + "customer": { + "fullName": "=concat(@(1,firstName),' ',@(1,lastName))", + "address": "=concat(@(0,street),', ',@(0,city),', ',@(0,state),' ',@(0,zip))" + }, + "items": { + "*": { + "inverse": "=divide(1,@(1,quantity))", + "newprice": "=divide(@(1,price),@(1,inverse))", + "price": "=toDouble(@(1,price))" + } + } + } + } + } + }, + { + "operation": "shift", + "spec": { + "orders": { + "*": { + "*": "orders[&1].&", + "items": { + "*": { + "*": "orders[&3].items[&1].&", + "newprice": "orders[&3].&" + } + } + } + } + } + }, + { + "operation": "modify-overwrite-beta", + "spec": { + "orders": { + "*": { + "newprice": "=doubleSum(@(1,newprice))" + } + } + } + }, + { + "operation": "remove", + "spec": { + "orders": { + "*": { + "items": { + "*": { + "inverse": "" + } + }, + "customer": { + "firstName": "", + "lastName": "" + } + } + } + } + } +] \ No newline at end of file From 7680f076b14276c227f91e8867a5a3235c5ae488 Mon Sep 17 00:00:00 2001 From: Kunal Date: Thu, 25 May 2023 16:02:47 +0530 Subject: [PATCH 03/12] rearranged the first_name and last_name field in the output in Problem 10 --- Problem10/output.json | 4 ++-- Problem10/spec.json | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Problem10/output.json b/Problem10/output.json index 3d677d2e..69f1ab5d 100644 --- a/Problem10/output.json +++ b/Problem10/output.json @@ -1,4 +1,6 @@ { + "first_name" : "John", + "last_name" : "Smith", "age" : 35, "address" : { "street" : "123 Main St", @@ -13,7 +15,5 @@ "type" : "work", "number" : "555-5678" } ], - "first_name" : "John", - "last_name" : "Smith", "phone_number_count" : 2 } \ No newline at end of file diff --git a/Problem10/spec.json b/Problem10/spec.json index 6c722ccf..1c4f6640 100644 --- a/Problem10/spec.json +++ b/Problem10/spec.json @@ -2,16 +2,21 @@ { "operation": "modify-overwrite-beta", "spec": { - "name": "=split(' ',@(1,name))", + "name": "=split(' ', @(1,name))", "first_name": "=firstElement(@(1,name))", "last_name": "=lastElement(@(1,name))", "phone_number_count": "=size(@(1,phone_numbers))" } }, { - "operation": "remove", + "operation": "shift", "spec": { - "name": "" + "first_name": "&", + "last_name": "&", + "age": "&", + "address": "&", + "phone_numbers": "&", + "phone_number_count": "&" } } ] \ No newline at end of file From ee21ae6c5a87139eef0dd36287ebc4ca273ed292 Mon Sep 17 00:00:00 2001 From: Kunal Date: Thu, 25 May 2023 16:13:10 +0530 Subject: [PATCH 04/12] corrected the output in Problem statement 12 --- Problem12/output.json | 2 +- Problem12/spec.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Problem12/output.json b/Problem12/output.json index ffd0ebfb..7f93b1ad 100644 --- a/Problem12/output.json +++ b/Problem12/output.json @@ -1,7 +1,7 @@ { "name" : "John Doe", "address" : "123 Main St, Anytown, CA 12345", - "phones" : [ { + "PhoneNumbers" : [ { "type" : "home", "number" : "555-555-1234" }, { diff --git a/Problem12/spec.json b/Problem12/spec.json index 3221f76a..ff6d4b91 100644 --- a/Problem12/spec.json +++ b/Problem12/spec.json @@ -12,9 +12,9 @@ "operation": "shift", "spec": { "employee": { - "name": "&", - "address": "&", - "phones": "&" + "name": "name", + "address": "address", + "phones": "PhoneNumbers" } } } From 826f98567946be7be51a0cd2b3cd0b5a3038c3d9 Mon Sep 17 00:00:00 2001 From: Kunal Date: Thu, 25 May 2023 16:19:07 +0530 Subject: [PATCH 05/12] Added the missing workPhone field in Problem statement 14 --- Problem14/output.json | 8 +++++--- Problem14/spec.json | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Problem14/output.json b/Problem14/output.json index 428cf26a..7f5aa959 100644 --- a/Problem14/output.json +++ b/Problem14/output.json @@ -3,11 +3,13 @@ "id" : "001", "name" : "John", "department" : "HR", - "homePhone" : "555-555-1234" + "homePhone" : "555-555-1234", + "workPhone" : "555-555-5678" }, { "id" : "002", "name" : "Jane", "department" : "Sales", - "homePhone" : "555-555-4567" + "homePhone" : "555-555-4567", + "workPhone" : "555-555-8901" } ] -} \ No newline at end of file +} diff --git a/Problem14/spec.json b/Problem14/spec.json index 317a6465..2fcd0156 100644 --- a/Problem14/spec.json +++ b/Problem14/spec.json @@ -5,7 +5,7 @@ "employees": { "*": { "homePhone": "@(1,phone[0].number)", - "workPhone": "@(1,number[1].number)" + "workPhone": "@(1,phone[1].number)" } } } @@ -20,4 +20,4 @@ } } } -] \ No newline at end of file +] From 6c56bf4fbb558c08576a7d351919528ed9fe2f00 Mon Sep 17 00:00:00 2001 From: Kunal Date: Thu, 25 May 2023 16:24:03 +0530 Subject: [PATCH 06/12] Added the Transformation spec.json in Problem statement 16 --- Problem16/output.json | 17 +++++------------ Problem16/spec.json | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Problem16/output.json b/Problem16/output.json index 3c72a2eb..a12bb43a 100644 --- a/Problem16/output.json +++ b/Problem16/output.json @@ -1,16 +1,9 @@ { - "Java": { - "Intermediate": [ - "John Doe" - ], - "Expert": [ - "Jane Doe", - "John Doe" - ] + "Java" : { + "Intermediate" : [ "John Doe" ], + "Expert" : [ "Jane Doe" ] }, - "Python": { - "Expert": [ - "John Doe" - ] + "Python" : { + "Expert" : [ "John Doe" ] } } \ No newline at end of file diff --git a/Problem16/spec.json b/Problem16/spec.json index e69de29b..ff221b01 100644 --- a/Problem16/spec.json +++ b/Problem16/spec.json @@ -0,0 +1,16 @@ +[ + { + "operation": "shift", + "spec": { + "employees": { + "*": { + "skills": { + "*": { + "@(2,name)": "@(1,name).@(1,level)[]" + } + } + } + } + } + } +] \ No newline at end of file From ebcc0b11ca8a8995f24633e7a6c7f88e6f57620e Mon Sep 17 00:00:00 2001 From: Kunal Date: Wed, 31 May 2023 19:07:35 +0530 Subject: [PATCH 07/12] use address key instead of traversing all keys in problem 9 --- Problem9/spec.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Problem9/spec.json b/Problem9/spec.json index a5eb8738..960b6437 100644 --- a/Problem9/spec.json +++ b/Problem9/spec.json @@ -2,7 +2,7 @@ { "operation": "remove", "spec": { - "*": { + "address": { "state": "" } } From 14b31c8db099f1d5d401181362032815f27c9a11 Mon Sep 17 00:00:00 2001 From: Kunal Date: Wed, 31 May 2023 19:14:23 +0530 Subject: [PATCH 08/12] used different approach in problem 30 --- Problem30/spec.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Problem30/spec.json b/Problem30/spec.json index 6bc650df..b135251b 100644 --- a/Problem30/spec.json +++ b/Problem30/spec.json @@ -3,12 +3,12 @@ "operation": "shift", "spec": { "person": { - "name": "name" + "name": "&" }, "employee": { "office": { - "city": "office_city", - "state": "office_state" + "city": "&1_&", + "state": "&1_&" } } } From 6b19a359388f40cc892bf8aa06589c29f3e2258a Mon Sep 17 00:00:00 2001 From: Kunal Date: Wed, 31 May 2023 19:17:30 +0530 Subject: [PATCH 09/12] removed unncessary field 'returnId' from spec in problem 26 --- Problem26/spec.json | 1 - 1 file changed, 1 deletion(-) diff --git a/Problem26/spec.json b/Problem26/spec.json index d6a95d8f..0e1d7bc7 100644 --- a/Problem26/spec.json +++ b/Problem26/spec.json @@ -3,7 +3,6 @@ "operation": "modify-overwrite-beta", "spec": { "*": { - "returnId": "@(1,Return Id)", "inverse": "=divide(1, @(1,returnPrice))", "Return Amount": "=divideAndRound(2, @(1,returnQuantity), @(1,inverse))", "Return Total Amount": "=doubleSum(@(1,returnTax),@(1,Return Amount))" From 66778fd9305169cfd3990a3cc55d2fa19e429ebd Mon Sep 17 00:00:00 2001 From: Kunal Date: Thu, 1 Jun 2023 00:50:21 +0530 Subject: [PATCH 10/12] Added explanation for all the problem in module 5. --- Problem1/approach.md | 22 ++++++++++++++++++++++ Problem10/approach.md | 10 ++++++++++ Problem11/approach.md | 7 +++++++ Problem12/approach.md | 10 ++++++++++ Problem13/approach.md | 9 +++++++++ Problem14/approach.md | 10 ++++++++++ Problem15/approach.md | 21 +++++++++++++++++++++ Problem16/approach.md | 7 +++++++ Problem17/approach.md | 7 +++++++ Problem18/approach.md | 10 ++++++++++ Problem19/approach.md | 10 ++++++++++ Problem2/approach.md | 7 +++++++ Problem21/approach.md | 7 +++++++ Problem22/approach.md | 7 +++++++ Problem23/approach.md | 7 +++++++ Problem24/approach.md | 7 +++++++ Problem25/approach.md | 7 +++++++ Problem26/approach.md | 16 ++++++++++++++++ Problem27/approach.md | 17 +++++++++++++++++ Problem28/approach.md | 10 ++++++++++ Problem29/approach.md | 7 +++++++ Problem3/approach.md | 7 +++++++ Problem30/approach.md | 7 +++++++ Problem31/approach.md | 11 +++++++++++ Problem32/approach.md | 7 +++++++ Problem33/approach.md | 7 +++++++ Problem34/approach.md | 7 +++++++ Problem4/approach.md | 7 +++++++ Problem5/approach.md | 10 ++++++++++ Problem6/approach.md | 9 +++++++++ Problem7/approach.md | 11 +++++++++++ Problem8/approach.md | 21 +++++++++++++++++++++ Problem9/approach.md | 7 +++++++ problem20/approach.md | 19 +++++++++++++++++++ 34 files changed, 345 insertions(+) create mode 100644 Problem1/approach.md create mode 100644 Problem10/approach.md create mode 100644 Problem11/approach.md create mode 100644 Problem12/approach.md create mode 100644 Problem13/approach.md create mode 100644 Problem14/approach.md create mode 100644 Problem15/approach.md create mode 100644 Problem16/approach.md create mode 100644 Problem17/approach.md create mode 100644 Problem18/approach.md create mode 100644 Problem19/approach.md create mode 100644 Problem2/approach.md create mode 100644 Problem21/approach.md create mode 100644 Problem22/approach.md create mode 100644 Problem23/approach.md create mode 100644 Problem24/approach.md create mode 100644 Problem25/approach.md create mode 100644 Problem26/approach.md create mode 100644 Problem27/approach.md create mode 100644 Problem28/approach.md create mode 100644 Problem29/approach.md create mode 100644 Problem3/approach.md create mode 100644 Problem30/approach.md create mode 100644 Problem31/approach.md create mode 100644 Problem32/approach.md create mode 100644 Problem33/approach.md create mode 100644 Problem34/approach.md create mode 100644 Problem4/approach.md create mode 100644 Problem5/approach.md create mode 100644 Problem6/approach.md create mode 100644 Problem7/approach.md create mode 100644 Problem8/approach.md create mode 100644 Problem9/approach.md create mode 100644 problem20/approach.md diff --git a/Problem1/approach.md b/Problem1/approach.md new file mode 100644 index 00000000..fe80061f --- /dev/null +++ b/Problem1/approach.md @@ -0,0 +1,22 @@ +### Number of Operations: 4 + +1. modify-overwrite-beta +2. shift +3. modify-overwrite-beta +4. remove + +### Explanation: + +1. Used modify-overwrite-beta operation and concating the firstName, lastName into new key fullName also concating the keys inside address (street, city,state,zip) into address field. + +created new fields:- + +inverse- inverse the quantity for multiplication. + +newPrice- using divide function to multiply the inverse of quantity to price and updating price to double. + +2. Used shift operation then to structure the fields to new location by shifting the newPrice in orders list. + +3. used modify-overwrite-beta to modify newPrice to double. + +4. Used remove operation removes unnecessary fields such as 'inverse' field from each item and the 'firstName' and 'lastName' fields from the customer. \ No newline at end of file diff --git a/Problem10/approach.md b/Problem10/approach.md new file mode 100644 index 00000000..aec737df --- /dev/null +++ b/Problem10/approach.md @@ -0,0 +1,10 @@ +### Number of Operations: 2 + +1. modify-overwrite-beta +2. shift + +### Explanation: + +1. Used modify-overwrite-beta operation first and split the name by space " " used firstElement, lastElement function to get first element and last element from name and then created two new keys first_name and last_name, also used size function to get the count of phone_numbers list of object store it in phone_number_count. + +2. Used shift operation then to structure the field according to output. \ No newline at end of file diff --git a/Problem11/approach.md b/Problem11/approach.md new file mode 100644 index 00000000..974eda0e --- /dev/null +++ b/Problem11/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. Used shift operation to change key 'name' and 'value' to 'itemName' and 'itemValue' inside items list by iterate over items. \ No newline at end of file diff --git a/Problem12/approach.md b/Problem12/approach.md new file mode 100644 index 00000000..ae59e15a --- /dev/null +++ b/Problem12/approach.md @@ -0,0 +1,10 @@ +### Number of Operations: 2 + +1. modify-overwrite-beta +2. shift + +### Explanation: + +1. Used modify-overwrite-beta operation to concat the firstName,lastName and stored in new field name, also concat the keys from address map (street, city, state, zip) in address key. + +2. Used shift operation to change phones list of object to PhoneNumbers and shifted name and address keys. diff --git a/Problem13/approach.md b/Problem13/approach.md new file mode 100644 index 00000000..ffc7523b --- /dev/null +++ b/Problem13/approach.md @@ -0,0 +1,9 @@ +### Number of Operations: 2 + +1. shift +2. remove + +### Explanation: + +1. Used shift operation to convert the list to object and gave the name 'id' for each object of employees. +2. used remove operation to remove the key 'id' from all the objects inside employees. \ No newline at end of file diff --git a/Problem14/approach.md b/Problem14/approach.md new file mode 100644 index 00000000..d8becc11 --- /dev/null +++ b/Problem14/approach.md @@ -0,0 +1,10 @@ +### Number of Operations: 2 + +1. modify-default-beta +2. remove + +### Explanation: + +1. Get the number at indices 0 and 1 inside 'phone' list which is inside employees list and store it in newly created fields 'homePhone' and 'workPhone' using modify-default-beta operation. + +2. used remove operation to remove the 'phone' from employees. \ No newline at end of file diff --git a/Problem15/approach.md b/Problem15/approach.md new file mode 100644 index 00000000..2a7228b1 --- /dev/null +++ b/Problem15/approach.md @@ -0,0 +1,21 @@ +### Number of Operations: 6 + +1. shift +2. shift +3. shift +4. modify-overwrite-beta +5. remove +6. sort + +### Explanation: +1. first shift operation structured the the value of customersId and having the orders list in it. + +2. using second shift operation the renames the root level key to "customers". + +3. third shift operation, arranges the customer list by getting each orders id, date and totalPrice fields as 'totalAmount' in form of an array. + +4. used modify-overwrite-beta, it modifies the customers by updating the 'totalAmount' using intSum function and also updates customerId. The first customer is assigned the name "John Doe", and the second customer is assigned the name "Jane Doe". + +5. Used remove operation is used to remove the "customerId" key from each order object under the 'customers' list. + +6. used sort to sort the customers list in ascending order. \ No newline at end of file diff --git a/Problem16/approach.md b/Problem16/approach.md new file mode 100644 index 00000000..a2b3731b --- /dev/null +++ b/Problem16/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. Used shift operation, to map the 'employees' array and 'skills' array to a new structure. It extracts the name of skills from skills array and stored the level and respective employee name in the form of list in the object of 'skills name'. \ No newline at end of file diff --git a/Problem17/approach.md b/Problem17/approach.md new file mode 100644 index 00000000..a0b30f0c --- /dev/null +++ b/Problem17/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. modify-default-beta + +### Explanation: + +1. used modify-default-beta operation to add key available with value 'false' inside the objects where available field in not present. \ No newline at end of file diff --git a/Problem18/approach.md b/Problem18/approach.md new file mode 100644 index 00000000..b2ae4214 --- /dev/null +++ b/Problem18/approach.md @@ -0,0 +1,10 @@ +### Number of Operations: 2 + +1. modify-overwrite-beta +2. remove + +### Explanation: + +1. Used modify-overwrite-beta operation over all fields inside employees list and used divide function and divide salary by 10 to get 10% of salary store it in incrementby, used intSum function and performed addition on salary field and incrementby and modify-overwrite-beta will update the salary. + +2. then used remove operation to remove the incrementby key(10% of salary) to get desired output. \ No newline at end of file diff --git a/Problem19/approach.md b/Problem19/approach.md new file mode 100644 index 00000000..2386ffca --- /dev/null +++ b/Problem19/approach.md @@ -0,0 +1,10 @@ +### Number of Operations: 2 + +1. modify-overwrite-beta +2. shift + +### Explanation: + +1. Used modify-overwrite-beta operation over all fields of products list and used divide function to divide "price" of each product by 2 and storing in a new field called 'mul'. then again used divide function to multiply the "price" by the "mul" value and storing in 'ans' + +2. Used shift operation and not changing the value of first object of products list by shifting the price as it is. Shifting the price of remaining objects inside products list. \ No newline at end of file diff --git a/Problem2/approach.md b/Problem2/approach.md new file mode 100644 index 00000000..8323e84e --- /dev/null +++ b/Problem2/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. Used shift operation to replace the keys 'name', 'city, 'age' with 'Name','Age' and 'City'. \ No newline at end of file diff --git a/Problem21/approach.md b/Problem21/approach.md new file mode 100644 index 00000000..cb484038 --- /dev/null +++ b/Problem21/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. used shift operation to traverse inside the restaurant map then get the value key present inside the rating map and change key value to Restaurant Rating key. \ No newline at end of file diff --git a/Problem22/approach.md b/Problem22/approach.md new file mode 100644 index 00000000..57109a6a --- /dev/null +++ b/Problem22/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. In the shift operation traversed inside the list of maps and for each map get the value of 'value' key present inside the rating map present in the restaurant map and created a list 3 level up and put the values in Restaurant Rating key. \ No newline at end of file diff --git a/Problem23/approach.md b/Problem23/approach.md new file mode 100644 index 00000000..91702f68 --- /dev/null +++ b/Problem23/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. Used shift operation traversed inside the list of maps and for each map get the value of 'value' keys present inside the rating and address maps present inside the restaurant map and created a list 3 level ups and put the values in 'Restaurant Rating' key and 'Restaurant Country' key. \ No newline at end of file diff --git a/Problem24/approach.md b/Problem24/approach.md new file mode 100644 index 00000000..faf43c74 --- /dev/null +++ b/Problem24/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. Used shift operation to changing key 'value' to 'Restaurant Rating' and key 'address' to 'Restaurant Country'. then traversed inside the 'itemList' list and changed the 'itemName' to 'Dish Name' and 'itemPrice' to 'Dish Price' stored in form of list. \ No newline at end of file diff --git a/Problem25/approach.md b/Problem25/approach.md new file mode 100644 index 00000000..720b63d7 --- /dev/null +++ b/Problem25/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. Used shift operation to changing key 'value' to 'Restaurant Rating' and key 'address' to 'Restaurant Country'. then traversed inside the 'itemList' list and changed the 'itemName' to 'Dish Name' and 'itemPrice' to 'Dish Price' storing it within the 'Dishes' list using "Dishes.[&1].Dish Price". \ No newline at end of file diff --git a/Problem26/approach.md b/Problem26/approach.md new file mode 100644 index 00000000..d8b26bc9 --- /dev/null +++ b/Problem26/approach.md @@ -0,0 +1,16 @@ +### Number of Operations: 2 + +1. modify-overwrite-beta +2. remove + +### Explanation: + +1. used modify-overwrite-beta operation and created new fields:- + +inverse - this is to inverse the returnPrice for multiplication. + +Return Amount - dividing the inverse of returnPrice(inverse) and returnQuantity to performed multiplication + +Return Total Amount - used doubleSum function to add returnTax and Return Amount + +2. used remove operation and removed returnQuantity, returnPrice, returnTax and inverse. \ No newline at end of file diff --git a/Problem27/approach.md b/Problem27/approach.md new file mode 100644 index 00000000..d6daebc3 --- /dev/null +++ b/Problem27/approach.md @@ -0,0 +1,17 @@ +### Number of Operations: 2 + +1. modify-overwrite-beta +2. shift +3. modify-overwrite-beta + +### Explanation: + +1. In first operation, used modify-overwrite-beta and created new fields - + +quantity - inverse the returnQuantity using divide function for multiplication. Again using divide function and divide returnPrice to quantity(inverse of returnQuantity) to perform multiplication and updated the returnPrice field. + +returnTotal - to store the returnPrice in this field. + +2. used shift operation to get the required fields by changing name to ReturnId, Return Amount, Return Total Amount and country full forms using # and NA where no country name needed. + +3. Used modify-overwrite-beta in third operation and used doubleSum function to sum the Return Total Amount. diff --git a/Problem28/approach.md b/Problem28/approach.md new file mode 100644 index 00000000..258c8369 --- /dev/null +++ b/Problem28/approach.md @@ -0,0 +1,10 @@ +### Number of Operations: 2 + +1. shift +2. modify-overwrite-beta + +### Explanation: + +1. used shift operation first to get the 'returnId', and transforming the 'amount' key present inside returnitemAdjustments to 'returnTax' list. + +2. In second operation, used modify-overwrite-beta to sum the returnTax values using the 'doubleSum' function to add up all the values of 'returnTax' and overwrites the original 'returnTax' field with the sum. \ No newline at end of file diff --git a/Problem29/approach.md b/Problem29/approach.md new file mode 100644 index 00000000..790c25dc --- /dev/null +++ b/Problem29/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1.shift operation to change all the keys of 'person' such as changed 'name' to 'person_name','age' to 'person_age'. Also changed the name of keys of 'address' such as 'city' to 'person_address_city' and 'state' to 'person_address_state'. \ No newline at end of file diff --git a/Problem3/approach.md b/Problem3/approach.md new file mode 100644 index 00000000..a0c1bda5 --- /dev/null +++ b/Problem3/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. Used shift operation to replace the keys name and age key with Name and Age. Shifted the value of city and phone key inside a Contact map with keys City and Phone. \ No newline at end of file diff --git a/Problem30/approach.md b/Problem30/approach.md new file mode 100644 index 00000000..f2330459 --- /dev/null +++ b/Problem30/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. used shift operation to get the 'name' from 'person' object and get all the keys from office object present within the employee object and changed the city to 'office_city',state to 'office_state'using &. \ No newline at end of file diff --git a/Problem31/approach.md b/Problem31/approach.md new file mode 100644 index 00000000..47152228 --- /dev/null +++ b/Problem31/approach.md @@ -0,0 +1,11 @@ +### Number of Operations: 2 + +1. modify-overwrite-beta +2. shift + +### Explanation: + +1. Used modify-overwrite-beta to modify the 'items' field by iterating over each item and their prices. +using concat function to concatenate 'id' field with the 'currency' field by an underscore, and store in key 'currency'. + +2. In second operation used shift to mapping the 'value' with the 'currency' field. \ No newline at end of file diff --git a/Problem32/approach.md b/Problem32/approach.md new file mode 100644 index 00000000..ca8b7f19 --- /dev/null +++ b/Problem32/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. used shift operation along with @(level,key) to get the value of the key x and y and change the structure of data. \ No newline at end of file diff --git a/Problem33/approach.md b/Problem33/approach.md new file mode 100644 index 00000000..1b2a833a --- /dev/null +++ b/Problem33/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. Used shift operation to get name and level from hobby object and changed it to 'hobby_name', 'hobby_level' and also get the id and name and stored all this keys into a list using #2 wildcard. \ No newline at end of file diff --git a/Problem34/approach.md b/Problem34/approach.md new file mode 100644 index 00000000..a3cf34ab --- /dev/null +++ b/Problem34/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. Created the hobbies list of object, shifted name and level into different objects inside hobbiesusing shift operation. \ No newline at end of file diff --git a/Problem4/approach.md b/Problem4/approach.md new file mode 100644 index 00000000..7e9fc862 --- /dev/null +++ b/Problem4/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. shift + +### Explanation: + +1. Used shift operation to replace name and age keys with Name and Age. Shifted all values of hobbies list inside a List of maps Hobbies and changed the name of each key to 'Name' key using @ wildcard. \ No newline at end of file diff --git a/Problem5/approach.md b/Problem5/approach.md new file mode 100644 index 00000000..4d5ebfdd --- /dev/null +++ b/Problem5/approach.md @@ -0,0 +1,10 @@ +### Number of Operations: 2 + +1. modify-default-beta +2. shift + +### Explanation: + +1. Used modify-default-beta operation and used concate function on firstName and lastName and creating a new field fullName. + +2. In second operation used Shift operation to get only fullName, email and used * to get all fields and shifted city and zip. \ No newline at end of file diff --git a/Problem6/approach.md b/Problem6/approach.md new file mode 100644 index 00000000..6fa888a0 --- /dev/null +++ b/Problem6/approach.md @@ -0,0 +1,9 @@ +### Number of Operations: 2 +1. modify-overwrite-beta +2. shift + +### Explanation: + +1. In first operation concating the keys inside address object(street, city,state, zip) using concat function. + +2. Used shift operation then to structure the field according to output. \ No newline at end of file diff --git a/Problem7/approach.md b/Problem7/approach.md new file mode 100644 index 00000000..d983e0da --- /dev/null +++ b/Problem7/approach.md @@ -0,0 +1,11 @@ +### Number of Operations: 2 + +1. modify-overwrite-beta +2. shift + +### Explanation: + + +1. Used modify-overwrite-beta operation first and split the email by @ then used lastElement function to selected the last element from splitted email and stored it key named as domain. + +2. Used shift operation then to traversed inside the students list and then created a list 1 levels up with keys as Name, Age and Domain. \ No newline at end of file diff --git a/Problem8/approach.md b/Problem8/approach.md new file mode 100644 index 00000000..b84859f9 --- /dev/null +++ b/Problem8/approach.md @@ -0,0 +1,21 @@ +### Number of Operations: 6 + +1. modify-default-beta +2. shift +3. modify-overwrite-beta +4. shift +5. shift +6. modify-overwrite-beta + +### Explanation: + +1. In first operation, I am adding the department, salary key and their values required. + +2. In second operation, Created a map with their respective departments. + +3. Used modify-overwrite-beta, and selected Sales and IT department with 2% bonus +and giving the 2.5% bonus to the Marketing department. + +4. Now converted the maps to list and made list of all bonus as totalBonus + +5. now adding the totalBonus using doubleSum and then convert bonus to Integer using toInteger function. \ No newline at end of file diff --git a/Problem9/approach.md b/Problem9/approach.md new file mode 100644 index 00000000..fca4a2e1 --- /dev/null +++ b/Problem9/approach.md @@ -0,0 +1,7 @@ +### Number of Operations: 1 + +1. remove + +### Explanation: + +1. Used remove operation to remove the key 'state' from the 'address' object. \ No newline at end of file diff --git a/problem20/approach.md b/problem20/approach.md new file mode 100644 index 00000000..84ea3188 --- /dev/null +++ b/problem20/approach.md @@ -0,0 +1,19 @@ +### Number of Operations: 4 + +1. shift +2. shift +3. shift +4. modify-overwrite-beta +5. shift + +### Explanation: + +1. First shift operation will get the keys 'id' and 'name' from the department and employee 'age' and 'name' this create a new list of objects named 'departments' having objects in it having fields 'id', 'name', 'employees' object with 'name' and 'age' + +2. Second shift operation structured the 'departments' and create the list inside it by using the values from department's id as key. + +3. Third shift operation it structured the 'departments' by getting id and department name in form of list. + +4. used modify-overwrite-beta operation, Map the first element of the 'id' field to the 'id' field itself and the first element of the 'name' field to the 'name' field itself. + +5. last shift operator shifts the 'departments' list by moving the department to root and shows all the fields in department list. \ No newline at end of file From 3b53488e30d0712ccfbba82eda4e0b7d7763d7c2 Mon Sep 17 00:00:00 2001 From: Kunal Date: Mon, 5 Jun 2023 18:04:29 +0530 Subject: [PATCH 11/12] Corrected the problem 1 (changed the variable name from newprice to total and updated the approach.md file) --- Problem1/approach.md | 2 +- Problem1/output.json | 4 ++-- Problem1/spec.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Problem1/approach.md b/Problem1/approach.md index fe80061f..15241274 100644 --- a/Problem1/approach.md +++ b/Problem1/approach.md @@ -17,6 +17,6 @@ newPrice- using divide function to multiply the inverse of quantity to price and 2. Used shift operation then to structure the fields to new location by shifting the newPrice in orders list. -3. used modify-overwrite-beta to modify newPrice to double. +3. used modify-overwrite-beta to modify total to double. 4. Used remove operation removes unnecessary fields such as 'inverse' field from each item and the 'firstName' and 'lastName' fields from the customer. \ No newline at end of file diff --git a/Problem1/output.json b/Problem1/output.json index 75f263e5..7559f3d8 100644 --- a/Problem1/output.json +++ b/Problem1/output.json @@ -19,7 +19,7 @@ "quantity" : 1, "price" : 20.0 } ], - "newprice" : 40.0 + "total" : 40.0 }, { "orderId" : 2, "orderDate" : "2022-02-21T09:12:34Z", @@ -35,6 +35,6 @@ "quantity" : 3, "price" : 15.0 } ], - "newprice" : 45.0 + "total" : 45.0 } ] } \ No newline at end of file diff --git a/Problem1/spec.json b/Problem1/spec.json index e3f83901..e37b98c9 100644 --- a/Problem1/spec.json +++ b/Problem1/spec.json @@ -28,7 +28,7 @@ "items": { "*": { "*": "orders[&3].items[&1].&", - "newprice": "orders[&3].&" + "newprice": "orders[&3].total" } } } @@ -40,7 +40,7 @@ "spec": { "orders": { "*": { - "newprice": "=doubleSum(@(1,newprice))" + "total": "=doubleSum(@(1,total))" } } } From e0b65b4fcfca422775ddf75b014581952abea50a Mon Sep 17 00:00:00 2001 From: Kunal Date: Wed, 7 Jun 2023 12:54:07 +0530 Subject: [PATCH 12/12] Corrected the problem 19 (changed the variable name from ans to price) --- Problem19/output.json | 6 +++--- Problem19/spec.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Problem19/output.json b/Problem19/output.json index ca9db584..f5308be7 100644 --- a/Problem19/output.json +++ b/Problem19/output.json @@ -6,10 +6,10 @@ }, { "id" : "1002", "name" : "Product 2", - "ans" : 31.98 + "price" : 31.98 }, { "id" : "1003", "name" : "Product 3", - "ans" : 41.98 + "price" : 41.98 } ] -} \ No newline at end of file +} diff --git a/Problem19/spec.json b/Problem19/spec.json index f72a95c9..59a094e0 100644 --- a/Problem19/spec.json +++ b/Problem19/spec.json @@ -23,7 +23,7 @@ "*": { "id": "products.[&1].&", "name": "products.[&1].&", - "ans": "products.[&1].&" + "ans": "products.[&1].price" } } }