{"action":"created","issue":{"url":"https://api.github.com/repos/bazaarvoice/jolt/issues/680","repository_url":"https://api.github.com/repos/bazaarvoice/jolt","labels_url":"https://api.github.com/repos/bazaarvoice/jolt/issues/680/labels{/name}","comments_url":"https://api.github.com/repos/bazaarvoice/jolt/issues/680/comments","events_url":"https://api.github.com/repos/bazaarvoice/jolt/issues/680/events","html_url":"https://github.com/bazaarvoice/jolt/issues/680","id":368282898,"node_id":"MDU6SXNzdWUzNjgyODI4OTg=","number":680,"title":"Slight modification to existing code, need help","user":{"login":"steveLandes","id":43789429,"node_id":"MDQ6VXNlcjQzNzg5NDI5","avatar_url":"https://avatars1.githubusercontent.com/u/43789429?v=4","gravatar_id":"","url":"https://api.github.com/users/steveLandes","html_url":"https://github.com/steveLandes","followers_url":"https://api.github.com/users/steveLandes/followers","following_url":"https://api.github.com/users/steveLandes/following{/other_user}","gists_url":"https://api.github.com/users/steveLandes/gists{/gist_id}","starred_url":"https://api.github.com/users/steveLandes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveLandes/subscriptions","organizations_url":"https://api.github.com/users/steveLandes/orgs","repos_url":"https://api.github.com/users/steveLandes/repos","events_url":"https://api.github.com/users/steveLandes/events{/privacy}","received_events_url":"https://api.github.com/users/steveLandes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-09T15:58:48Z","updated_at":"2018-10-09T16:48:11Z","closed_at":null,"author_association":"NONE","body":"You helped me a lot with https://github.com/bazaarvoice/jolt/issues/673\r\n\r\nI have had a request to slightly modify the output from that spec.  I'll repost the relevant stuff here for convenience.\r\n\r\nInput: \r\n```\r\n{\r\n  \"data\": {\r\n    \"user\": {\r\n      \"active\": false,\r\n      \"displayName\": \"string\",\r\n      \"userId\": \"d3459481-fb1c-48bb-8685-40eb629e2ae1\",\r\n      \"externalId\": \"d3459481-fb1c-48bb-8685-40eb629e2ae1\",\r\n      \"id\": \"string\",\r\n      \"locale\": \"en-US\",\r\n      \"meta\": {\r\n        \"attributes\": [\r\n          \"string\"\r\n        ],\r\n        \"created\": \"2018-09-26T20:29:12.374Z\",\r\n        \"lastModified\": \"2018-09-26T20:29:12.374Z\",\r\n        \"location\": \"string\",\r\n        \"resourceType\": \"string\",\r\n        \"version\": \"string\"\r\n      },\r\n      \"nickName\": \"string\",\r\n      \"password\": \"string\",\r\n      \"preferredLanguage\": \"en\",\r\n      \"profileUrl\": \"string\",\r\n      \"timezone\": \"string\",\r\n      \"title\": \"string\",\r\n      \"userName\": \"username\",\r\n      \"userType\": \"string\"\r\n    },\r\n    \"products\": [\r\n      {\r\n        \"product\": \"product1\",\r\n        \"consents\": [\r\n          {\r\n            \"uuid\": \"d3459481-fb1c-48bb-8685-40eb629e2ae1\",\r\n            \"useCategoryCode\": \"tc\",\r\n            \"serviceCode\": \"pc\",\r\n            \"serviceFunctionCode\": \"pc-reg\",\r\n            \"country\": \"US\",\r\n            \"language\": \"en\",\r\n            \"status\": \"OptIn\",\r\n            \"consentDate\": \"2019-02-03\"\r\n          }\r\n        ],\r\n        \"object\": {}\r\n      },\r\n      {\r\n        \"product\": \"product2\",\r\n        \"consents\": [\r\n          {\r\n            \"uuid\": \"d3459481-fb1c-48bb-8685-40eb629e2ae2\",\r\n            \"useCategoryCode\": \"tc\",\r\n            \"serviceCode\": \"pc\",\r\n            \"serviceFunctionCode\": \"pc-reg\",\r\n            \"country\": \"US\",\r\n            \"language\": \"en\",\r\n            \"status\": \"OptIn\",\r\n            \"consentDate\": \"2019-02-03\"\r\n          }\r\n        ],\r\n        \"object\": {}\r\n      }\r\n    ]\r\n  }\r\n}\r\n```\r\n\r\nOld Spec:\r\n```\r\n{\r\n  \"data\": {\r\n    \"user\": {\r\n      \"active\": false,\r\n      \"displayName\": \"string\",\r\n      \"userId\": \"d3459481-fb1c-48bb-8685-40eb629e2ae1\",\r\n      \"externalId\": \"d3459481-fb1c-48bb-8685-40eb629e2ae1\",\r\n      \"id\": \"string\",\r\n      \"locale\": \"en-US\",\r\n      \"meta\": {\r\n        \"attributes\": [\r\n          \"string\"\r\n        ],\r\n        \"created\": \"2018-09-26T20:29:12.374Z\",\r\n        \"lastModified\": \"2018-09-26T20:29:12.374Z\",\r\n        \"location\": \"string\",\r\n        \"resourceType\": \"string\",\r\n        \"version\": \"string\"\r\n      },\r\n      \"nickName\": \"string\",\r\n      \"password\": \"string\",\r\n      \"preferredLanguage\": \"en\",\r\n      \"profileUrl\": \"string\",\r\n      \"timezone\": \"string\",\r\n      \"title\": \"string\",\r\n      \"userName\": \"username\",\r\n      \"userType\": \"string\"\r\n    },\r\n    \"products\": [\r\n      {\r\n        \"product\": \"product1\",\r\n        \"consents\": [\r\n          {\r\n            \"uuid\": \"d3459481-fb1c-48bb-8685-40eb629e2ae1\",\r\n            \"useCategoryCode\": \"tc\",\r\n            \"serviceCode\": \"pc\",\r\n            \"serviceFunctionCode\": \"pc-reg\",\r\n            \"country\": \"US\",\r\n            \"language\": \"en\",\r\n            \"status\": \"OptIn\",\r\n            \"consentDate\": \"2019-02-03\"\r\n          }\r\n        ],\r\n        \"object\": {}\r\n      },\r\n      {\r\n        \"product\": \"product2\",\r\n        \"consents\": [\r\n          {\r\n            \"uuid\": \"d3459481-fb1c-48bb-8685-40eb629e2ae2\",\r\n            \"useCategoryCode\": \"tc\",\r\n            \"serviceCode\": \"pc\",\r\n            \"serviceFunctionCode\": \"pc-reg\",\r\n            \"country\": \"US\",\r\n            \"language\": \"en\",\r\n            \"status\": \"OptIn\",\r\n            \"consentDate\": \"2019-02-03\"\r\n          }\r\n        ],\r\n        \"object\": {}\r\n      }\r\n    ]\r\n  }\r\n}\r\n```\r\n\r\nOLD Desired output:\r\n```\r\n{\r\n  \"consentData\": [\r\n    {\r\n      \"agreed\": true, \r\n      \"consentType\": \"string\", \r\n      \"consentedDate\": \"2019-02-03\",\r\n      \"currentVersion\": \"v1\",\r\n      \"lastModifiedDate\": \"2018-10-01T15:31:19.429Z\", \r\n      \"locale\": \"string\", \r\n      \"required\": true,\r\n      \"serviceCode\": \"string\", \r\n      \"serviceFunctionCode\": \"string\", \r\n      \"useCategoryCode\": \"string\", \r\n      \"uuid\": \"d3459481-fb1c-48bb-8685-40eb629e2ae1\"\r\n    },\r\n    {\r\n      \"agreed\": true,\r\n      \"consentType\": \"string\",\r\n      \"consentedDate\": \"2019-02-03\",\r\n      \"currentVersion\": \"v1\",\r\n      \"lastModifiedDate\": \"2018-10-01T15:31:19.429Z\",\r\n      \"locale\": \"string\",\r\n      \"required\": false,\r\n      \"serviceCode\": \"string\",\r\n      \"serviceFunctionCode\": \"string\",\r\n      \"useCategoryCode\": \"string\",\r\n      \"uuid\": \"d3459481-fb1c-48bb-8685-40eb629e2ae2\"\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nNEW desired output (new lines have comments to clearly show them):\r\n```\r\n{\r\n  \"userConsents\": {     //NEW LEVEL OF ORGANIZATION\r\n    \"userId\": \"d3459481-fb1c-48bb-8685-40eb629e2ae1\",  //NEW FIELD (data.user.userId)\r\n    \"userName\":  \"username\",  //NEW FIELD (data.user.username)\r\n    \"consentData\": [\r\n      {\r\n        \"agreed\": true,   \r\n        \"consentType\": \"string\", \r\n        \"consentedDate\": \"2019-02-03\",  \r\n        \"currentVersion\": \"v1\",  \r\n        \"lastModifiedDate\": \"2018-10-01T15:31:19.429Z\",\r\n        \"locale\": \"string\", \r\n        \"required\": true, \r\n        \"serviceCode\": \"string\", \r\n        \"serviceFunctionCode\": \"string\", \r\n        \"useCategoryCode\": \"string\",  \r\n        \"uuid\": \"d3459481-fb1c-48bb-8685-40eb629e2ae1\"\r\n      },\r\n      {\r\n        \"agreed\": true,\r\n        \"consentType\": \"string\",\r\n        \"consentedDate\": \"2019-02-03\",\r\n        \"currentVersion\": \"v1\",\r\n        \"lastModifiedDate\": \"2018-10-01T15:31:19.429Z\",\r\n        \"locale\": \"string\",\r\n        \"required\": false,\r\n        \"serviceCode\": \"string\",\r\n        \"serviceFunctionCode\": \"string\",\r\n        \"useCategoryCode\": \"string\",\r\n        \"uuid\": \"d3459481-fb1c-48bb-8685-40eb629e2ae2\"\r\n      }\r\n    ]\r\n  }\r\n}\r\n```\r\n\r\nBasically, I need to add the userConsents field, and shift everything up underneath it while adding 2 new fields underneath that.  No idea how to do it.\r\n"},"comment":{"url":"https://api.github.com/repos/bazaarvoice/jolt/issues/comments/428266414","html_url":"https://github.com/bazaarvoice/jolt/issues/680#issuecomment-428266414","issue_url":"https://api.github.com/repos/bazaarvoice/jolt/issues/680","id":428266414,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODI2NjQxNA==","user":{"login":"jashgala","id":16336864,"node_id":"MDQ6VXNlcjE2MzM2ODY0","avatar_url":"https://avatars3.githubusercontent.com/u/16336864?v=4","gravatar_id":"","url":"https://api.github.com/users/jashgala","html_url":"https://github.com/jashgala","followers_url":"https://api.github.com/users/jashgala/followers","following_url":"https://api.github.com/users/jashgala/following{/other_user}","gists_url":"https://api.github.com/users/jashgala/gists{/gist_id}","starred_url":"https://api.github.com/users/jashgala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jashgala/subscriptions","organizations_url":"https://api.github.com/users/jashgala/orgs","repos_url":"https://api.github.com/users/jashgala/repos","events_url":"https://api.github.com/users/jashgala/events{/privacy}","received_events_url":"https://api.github.com/users/jashgala/received_events","type":"User","site_admin":false},"created_at":"2018-10-09T16:48:11Z","updated_at":"2018-10-09T16:48:11Z","author_association":"NONE","body":"I think the old spec you added contains the input json itself by accident. Can you please check it?"}}
{"actor":{"display_login":"jashgala"}}