{"action":"created","issue":{"url":"https://api.github.com/repos/agershun/alasql/issues/551","labels_url":"https://api.github.com/repos/agershun/alasql/issues/551/labels{/name}","comments_url":"https://api.github.com/repos/agershun/alasql/issues/551/comments","events_url":"https://api.github.com/repos/agershun/alasql/issues/551/events","html_url":"https://github.com/agershun/alasql/issues/551","id":127429226,"number":551,"title":"Merge nested","user":{"login":"MarioVanDenEijnde","id":12608918,"avatar_url":"https://avatars.githubusercontent.com/u/12608918?v=3","gravatar_id":"","url":"https://api.github.com/users/MarioVanDenEijnde","html_url":"https://github.com/MarioVanDenEijnde","followers_url":"https://api.github.com/users/MarioVanDenEijnde/followers","following_url":"https://api.github.com/users/MarioVanDenEijnde/following{/other_user}","gists_url":"https://api.github.com/users/MarioVanDenEijnde/gists{/gist_id}","starred_url":"https://api.github.com/users/MarioVanDenEijnde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarioVanDenEijnde/subscriptions","organizations_url":"https://api.github.com/users/MarioVanDenEijnde/orgs","repos_url":"https://api.github.com/users/MarioVanDenEijnde/repos","events_url":"https://api.github.com/users/MarioVanDenEijnde/events{/privacy}","received_events_url":"https://api.github.com/users/MarioVanDenEijnde/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/agershun/alasql/labels/Answered","name":"Answered","color":"eb6420"},{"url":"https://api.github.com/repos/agershun/alasql/labels/Question","name":"Question","color":"cc317c"}],"state":"open","locked":false,"assignee":{"login":"agershun","id":643040,"avatar_url":"https://avatars.githubusercontent.com/u/643040?v=3","gravatar_id":"","url":"https://api.github.com/users/agershun","html_url":"https://github.com/agershun","followers_url":"https://api.github.com/users/agershun/followers","following_url":"https://api.github.com/users/agershun/following{/other_user}","gists_url":"https://api.github.com/users/agershun/gists{/gist_id}","starred_url":"https://api.github.com/users/agershun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agershun/subscriptions","organizations_url":"https://api.github.com/users/agershun/orgs","repos_url":"https://api.github.com/users/agershun/repos","events_url":"https://api.github.com/users/agershun/events{/privacy}","received_events_url":"https://api.github.com/users/agershun/received_events","type":"User","site_admin":false},"milestone":null,"comments":15,"created_at":"2016-01-19T11:55:57Z","updated_at":"2016-01-19T15:04:38Z","closed_at":null,"body":"Hello alasql team,\r\n\r\nHow can we merge json objects that include nested objects?\r\nWe tried JOIN and EXTEND and UNION but cannot seem to get the right result\r\n\r\nPlease advise.\r\n\r\n```\r\nres1: [{\"inspecteur\":\"Jan\",\"keuring\":[{\"keuring\":\"Keuring 03\",\"inspecteur\":\"Jan\",\"date\":\"2016-01-22\"},{\"keuring\":\"Keuring 04\",\"inspecteur\":\"Jan\",\"date\":\"2016-01-20\"},{\"keuring\":\"Keuring 01\",\"inspecteur\":\"Jan\",\"date\":\"2016-01-18\"}]},{\"inspecteur\":\"Piet\",\"keuring\":[{\"keuring\":\"Keuring 02\",\"inspecteur\":\"Piet\",\"date\":\"2016-01-20\"}]}]\r\n```\r\n```\r\nres2: [{\"inspecteur\":\"Jan\",\"keuring\":[{\"date\":\"2016-01-18\"},{\"date\":\"2016-01-19\"},{\"date\":\"2016-01-20\"},{\"date\":\"2016-01-21\"},{\"date\":\"2016-01-22\"},{\"date\":\"2016-01-18\"},{\"date\":\"2016-01-19\"},{\"date\":\"2016-01-20\"},{\"date\":\"2016-01-21\"},{\"date\":\"2016-01-22\"},{\"date\":\"2016-01-18\"},{\"date\":\"2016-01-19\"},{\"date\":\"2016-01-20\"},{\"date\":\"2016-01-21\"},{\"date\":\"2016-01-22\"}]},{\"inspecteur\":\"Piet\",\"keuring\":[{\"date\":\"2016-01-18\"},{\"date\":\"2016-01-19\"},{\"date\":\"2016-01-20\"},{\"date\":\"2016-01-21\"},{\"date\":\"2016-01-22\"}]}]\r\n```\r\nresult should be:\r\n```\r\nres3: [{\"inspecteur\":\"Jan\",\"keuring\":[{\"keuring\":\"Keuring 01\",\"inspecteur\":\"Jan\",\"date\":\"2016-01-18\"},{\"date\":\"2016-01-19\"},{\"keuring\":\"Keuring 04\",\"inspecteur\":\"Jan\",\"date\":\"2016-01-20\"},{\"date\":\"2016-01-21\"},{\"keuring\":\"Keuring 03\",\"inspecteur\":\"Jan\",\"date\":\"2016-01-22\"},{\"date\":\"2016-01-18\"},{\"date\":\"2016-01-19\"},{\"date\":\"2016-01-20\"},{\"date\":\"2016-01-21\"},{\"date\":\"2016-01-22\"},{\"date\":\"2016-01-18\"},{\"date\":\"2016-01-19\"},{\"date\":\"2016-01-20\"},{\"date\":\"2016-01-21\"},{\"date\":\"2016-01-22\"}]},{\"inspecteur\":\"Piet\",\"keuring\":[{\"date\":\"2016-01-18\"},{\"date\":\"2016-01-19\"},{\"keuring\":\"Keuring 02\",\"inspecteur\":\"Piet\",\"date\":\"2016-01-20\"},{\"date\":\"2016-01-21\"},{\"date\":\"2016-01-22\"}]}]\r\n```"},"comment":{"url":"https://api.github.com/repos/agershun/alasql/issues/comments/172879871","html_url":"https://github.com/agershun/alasql/issues/551#issuecomment-172879871","issue_url":"https://api.github.com/repos/agershun/alasql/issues/551","id":172879871,"user":{"login":"MarioVanDenEijnde","id":12608918,"avatar_url":"https://avatars.githubusercontent.com/u/12608918?v=3","gravatar_id":"","url":"https://api.github.com/users/MarioVanDenEijnde","html_url":"https://github.com/MarioVanDenEijnde","followers_url":"https://api.github.com/users/MarioVanDenEijnde/followers","following_url":"https://api.github.com/users/MarioVanDenEijnde/following{/other_user}","gists_url":"https://api.github.com/users/MarioVanDenEijnde/gists{/gist_id}","starred_url":"https://api.github.com/users/MarioVanDenEijnde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarioVanDenEijnde/subscriptions","organizations_url":"https://api.github.com/users/MarioVanDenEijnde/orgs","repos_url":"https://api.github.com/users/MarioVanDenEijnde/repos","events_url":"https://api.github.com/users/MarioVanDenEijnde/events{/privacy}","received_events_url":"https://api.github.com/users/MarioVanDenEijnde/received_events","type":"User","site_admin":false},"created_at":"2016-01-19T15:04:38Z","updated_at":"2016-01-19T15:04:38Z","body":"Hello Guys,\r\n\r\nAre you interested in another piece of the puzzle?\r\nThis is what we got:\r\n```\r\n[{\"title\":\"Keuring 03\",\"inspecteur\":\"Jan\",\"date\":\"2016-01-22\"},\r\n{\"title\":\"Keuring 04\",\"inspecteur\":\"Jan\",\"date\":\"2016-01-20\"},\r\n{\"title\":\"Keuring 02\",\"inspecteur\":\"Piet\",\"date\":\"2016-01-20\"},\r\n{\"title\":\"Keuring 05\",\"inspecteur\":\"Jan\",\"date\":\"2016-01-20\"},\r\n{\"title\":\"Keuring 01\",\"inspecteur\":\"Jan\",\"date\":\"2016-01-18\"}]\r\n```\r\nThis is the result we need:\r\n```\r\n[\r\n\t{\t\"inspecteur\":\"Jan\",\r\n\t\tdates:\r\n\t\t\t[\r\n\t\t\t\t{\t\"date\":\"2016-01-22\",\r\n\t\t\t\t\tkeuringen:\r\n\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t{\t\"title\":\"Keuring 03\"\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t]\r\n\t\t\t\t},\r\n\t\t\t\t{\t\"date\":\"2016-01-20\",\r\n\t\t\t\t\tkeuringen:\r\n\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t{\t\"title\":\"Keuring 04\"\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t{\t\"title\":\"Keuring 05\"\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t]\r\n\t\t\t\t},\r\n\t\t\t\t{\t\"date\":\"2016-01-18\",\r\n\t\t\t\t\tkeuringen:\r\n\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t{\t\"title\":\"Keuring 01\"\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t]\r\n\t\t\t\t}\r\n\t\t\t]\r\n\t},\r\n\t{\t\"inspecteur\":\"Piet\",\r\n\t\tdates:\r\n\t\t\t[\r\n\t\t\t\t{\t\"date\":\"2016-01-20\",\r\n\t\t\t\t\tkeuringen:\r\n\t\t\t\t\t\t[\r\n\t\t\t\t\t\t\t{\t\"title\":\"Keuring 02\"\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t]\r\n\t\t\t\t}\r\n\t\t\t]\r\n\t}\r\n]\r\n```\r\n\r\nKind regards,\r\nMario"}}