{"action":"closed","number":4,"pull_request":{"url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/pulls/4","id":228821690,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4ODIxNjkw","html_url":"https://github.com/KeyboardInterrupt/ansible_xlsx_inventory/pull/4","diff_url":"https://github.com/KeyboardInterrupt/ansible_xlsx_inventory/pull/4.diff","patch_url":"https://github.com/KeyboardInterrupt/ansible_xlsx_inventory/pull/4.patch","issue_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/issues/4","number":4,"state":"closed","locked":false,"title":"Resolving TypeErrors when attempting to JSON serialize datetime objects","user":{"login":"mikerosile","id":5301832,"node_id":"MDQ6VXNlcjUzMDE4MzI=","avatar_url":"https://avatars1.githubusercontent.com/u/5301832?v=4","gravatar_id":"","url":"https://api.github.com/users/mikerosile","html_url":"https://github.com/mikerosile","followers_url":"https://api.github.com/users/mikerosile/followers","following_url":"https://api.github.com/users/mikerosile/following{/other_user}","gists_url":"https://api.github.com/users/mikerosile/gists{/gist_id}","starred_url":"https://api.github.com/users/mikerosile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikerosile/subscriptions","organizations_url":"https://api.github.com/users/mikerosile/orgs","repos_url":"https://api.github.com/users/mikerosile/repos","events_url":"https://api.github.com/users/mikerosile/events{/privacy}","received_events_url":"https://api.github.com/users/mikerosile/received_events","type":"User","site_admin":false},"body":"When using this tool on Excel data that had Date/Time fields, the script would error when attempting to JSON serialize the data.\r\n\r\nThe following error was generated:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"./xlsx_inventory.py\", line 149, in <module>\r\n    main()\r\n  File \"./xlsx_inventory.py\", line 53, in main\r\n    indent=4, sort_keys=True))\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py\", line 250, in dumps\r\n    sort_keys=sort_keys, **kw).encode(obj)\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py\", line 209, in encode\r\n    chunks = list(chunks)\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py\", line 434, in _iterencode\r\n    for chunk in _iterencode_dict(o, _current_indent_level):\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py\", line 408, in _iterencode_dict\r\n    for chunk in chunks:\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py\", line 442, in _iterencode\r\n    o = _default(o)\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py\", line 184, in default\r\n    raise TypeError(repr(o) + \" is not JSON serializable\")\r\nTypeError: datetime.datetime(2018, 10, 31, 20, 18) is not JSON serializable\r\n\r\n```\r\nI added the \"default=str\" parameter to the json.dumps call at line 53.\r\n\r\nFrom https://docs.python.org/2/library/json.html\r\n\"If specified, default should be a function that gets called for objects that can’t otherwise be serialized\"\r\n\r\nThis allows the datetime objects to be converted to strings, which is fairly accurate, and JSON serializable.","created_at":"2018-11-06T20:17:27Z","updated_at":"2018-11-06T20:47:58Z","closed_at":"2018-11-06T20:47:58Z","merged_at":null,"merge_commit_sha":"9f90f1a0e4e58f31871e5d6279555192353e5c26","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/pulls/4/commits","review_comments_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/pulls/4/comments","review_comment_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/pulls/comments{/number}","comments_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/issues/4/comments","statuses_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/statuses/fa7d8ba549131cf5ea804d06a9fa453f9acb52aa","head":{"label":"mikerosile:master","ref":"master","sha":"fa7d8ba549131cf5ea804d06a9fa453f9acb52aa","user":{"login":"mikerosile","id":5301832,"node_id":"MDQ6VXNlcjUzMDE4MzI=","avatar_url":"https://avatars1.githubusercontent.com/u/5301832?v=4","gravatar_id":"","url":"https://api.github.com/users/mikerosile","html_url":"https://github.com/mikerosile","followers_url":"https://api.github.com/users/mikerosile/followers","following_url":"https://api.github.com/users/mikerosile/following{/other_user}","gists_url":"https://api.github.com/users/mikerosile/gists{/gist_id}","starred_url":"https://api.github.com/users/mikerosile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikerosile/subscriptions","organizations_url":"https://api.github.com/users/mikerosile/orgs","repos_url":"https://api.github.com/users/mikerosile/repos","events_url":"https://api.github.com/users/mikerosile/events{/privacy}","received_events_url":"https://api.github.com/users/mikerosile/received_events","type":"User","site_admin":false},"repo":{"id":156441174,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY0NDExNzQ=","name":"ansible_xlsx_inventory","full_name":"mikerosile/ansible_xlsx_inventory","private":false,"owner":{"login":"mikerosile","id":5301832,"node_id":"MDQ6VXNlcjUzMDE4MzI=","avatar_url":"https://avatars1.githubusercontent.com/u/5301832?v=4","gravatar_id":"","url":"https://api.github.com/users/mikerosile","html_url":"https://github.com/mikerosile","followers_url":"https://api.github.com/users/mikerosile/followers","following_url":"https://api.github.com/users/mikerosile/following{/other_user}","gists_url":"https://api.github.com/users/mikerosile/gists{/gist_id}","starred_url":"https://api.github.com/users/mikerosile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikerosile/subscriptions","organizations_url":"https://api.github.com/users/mikerosile/orgs","repos_url":"https://api.github.com/users/mikerosile/repos","events_url":"https://api.github.com/users/mikerosile/events{/privacy}","received_events_url":"https://api.github.com/users/mikerosile/received_events","type":"User","site_admin":false},"html_url":"https://github.com/mikerosile/ansible_xlsx_inventory","description":"Turn any Excel Sheet into an Ansible Inventory","fork":true,"url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory","forks_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/forks","keys_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/teams","hooks_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/hooks","issue_events_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/issues/events{/number}","events_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/events","assignees_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/assignees{/user}","branches_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/branches{/branch}","tags_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/tags","blobs_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/git/refs{/sha}","trees_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/statuses/{sha}","languages_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/languages","stargazers_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/stargazers","contributors_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/contributors","subscribers_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/subscribers","subscription_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/subscription","commits_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/commits{/sha}","git_commits_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/git/commits{/sha}","comments_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/comments{/number}","issue_comment_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/issues/comments{/number}","contents_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/contents/{+path}","compare_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/merges","archive_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/downloads","issues_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/issues{/number}","pulls_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/pulls{/number}","milestones_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/milestones{/number}","notifications_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/labels{/name}","releases_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/releases{/id}","deployments_url":"https://api.github.com/repos/mikerosile/ansible_xlsx_inventory/deployments","created_at":"2018-11-06T20:09:56Z","updated_at":"2018-11-06T20:12:37Z","pushed_at":"2018-11-06T20:12:35Z","git_url":"git://github.com/mikerosile/ansible_xlsx_inventory.git","ssh_url":"git@github.com:mikerosile/ansible_xlsx_inventory.git","clone_url":"https://github.com/mikerosile/ansible_xlsx_inventory.git","svn_url":"https://github.com/mikerosile/ansible_xlsx_inventory","homepage":null,"size":34,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"KeyboardInterrupt:master","ref":"master","sha":"15d4705f04028b394fd848e7fee241763722fe51","user":{"login":"KeyboardInterrupt","id":26553592,"node_id":"MDQ6VXNlcjI2NTUzNTky","avatar_url":"https://avatars3.githubusercontent.com/u/26553592?v=4","gravatar_id":"","url":"https://api.github.com/users/KeyboardInterrupt","html_url":"https://github.com/KeyboardInterrupt","followers_url":"https://api.github.com/users/KeyboardInterrupt/followers","following_url":"https://api.github.com/users/KeyboardInterrupt/following{/other_user}","gists_url":"https://api.github.com/users/KeyboardInterrupt/gists{/gist_id}","starred_url":"https://api.github.com/users/KeyboardInterrupt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KeyboardInterrupt/subscriptions","organizations_url":"https://api.github.com/users/KeyboardInterrupt/orgs","repos_url":"https://api.github.com/users/KeyboardInterrupt/repos","events_url":"https://api.github.com/users/KeyboardInterrupt/events{/privacy}","received_events_url":"https://api.github.com/users/KeyboardInterrupt/received_events","type":"User","site_admin":false},"repo":{"id":150971915,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA5NzE5MTU=","name":"ansible_xlsx_inventory","full_name":"KeyboardInterrupt/ansible_xlsx_inventory","private":false,"owner":{"login":"KeyboardInterrupt","id":26553592,"node_id":"MDQ6VXNlcjI2NTUzNTky","avatar_url":"https://avatars3.githubusercontent.com/u/26553592?v=4","gravatar_id":"","url":"https://api.github.com/users/KeyboardInterrupt","html_url":"https://github.com/KeyboardInterrupt","followers_url":"https://api.github.com/users/KeyboardInterrupt/followers","following_url":"https://api.github.com/users/KeyboardInterrupt/following{/other_user}","gists_url":"https://api.github.com/users/KeyboardInterrupt/gists{/gist_id}","starred_url":"https://api.github.com/users/KeyboardInterrupt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KeyboardInterrupt/subscriptions","organizations_url":"https://api.github.com/users/KeyboardInterrupt/orgs","repos_url":"https://api.github.com/users/KeyboardInterrupt/repos","events_url":"https://api.github.com/users/KeyboardInterrupt/events{/privacy}","received_events_url":"https://api.github.com/users/KeyboardInterrupt/received_events","type":"User","site_admin":false},"html_url":"https://github.com/KeyboardInterrupt/ansible_xlsx_inventory","description":"Turn any Excel Sheet into an Ansible Inventory","fork":false,"url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory","forks_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/forks","keys_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/teams","hooks_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/hooks","issue_events_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/issues/events{/number}","events_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/events","assignees_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/assignees{/user}","branches_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/branches{/branch}","tags_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/tags","blobs_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/git/refs{/sha}","trees_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/statuses/{sha}","languages_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/languages","stargazers_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/stargazers","contributors_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/contributors","subscribers_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/subscribers","subscription_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/subscription","commits_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/commits{/sha}","git_commits_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/git/commits{/sha}","comments_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/comments{/number}","issue_comment_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/issues/comments{/number}","contents_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/contents/{+path}","compare_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/merges","archive_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/downloads","issues_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/issues{/number}","pulls_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/pulls{/number}","milestones_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/milestones{/number}","notifications_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/labels{/name}","releases_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/releases{/id}","deployments_url":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/deployments","created_at":"2018-09-30T13:57:31Z","updated_at":"2018-11-05T17:58:08Z","pushed_at":"2018-11-06T20:17:28Z","git_url":"git://github.com/KeyboardInterrupt/ansible_xlsx_inventory.git","ssh_url":"git@github.com:KeyboardInterrupt/ansible_xlsx_inventory.git","clone_url":"https://github.com/KeyboardInterrupt/ansible_xlsx_inventory.git","svn_url":"https://github.com/KeyboardInterrupt/ansible_xlsx_inventory","homepage":null,"size":34,"stargazers_count":20,"watchers_count":20,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":6,"open_issues":1,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/pulls/4"},"html":{"href":"https://github.com/KeyboardInterrupt/ansible_xlsx_inventory/pull/4"},"issue":{"href":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/issues/4"},"comments":{"href":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/KeyboardInterrupt/ansible_xlsx_inventory/statuses/fa7d8ba549131cf5ea804d06a9fa453f9acb52aa"}},"author_association":"NONE","merged":false,"mergeable":true,"rebaseable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":1,"deletions":1,"changed_files":1}}
{"actor":{"display_login":"mikerosile"}}