{"action":"created","issue":{"url":"https://api.github.com/repos/cloudant/sync-cordova-plugin/issues/90","repository_url":"https://api.github.com/repos/cloudant/sync-cordova-plugin","labels_url":"https://api.github.com/repos/cloudant/sync-cordova-plugin/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/cloudant/sync-cordova-plugin/issues/90/comments","events_url":"https://api.github.com/repos/cloudant/sync-cordova-plugin/issues/90/events","html_url":"https://github.com/cloudant/sync-cordova-plugin/issues/90","id":247899031,"number":90,"title":"Issue in conversion of Map to JSONObject in buildJSON method","user":{"login":"cmijum","id":14971151,"avatar_url":"https://avatars3.githubusercontent.com/u/14971151?v=4","gravatar_id":"","url":"https://api.github.com/users/cmijum","html_url":"https://github.com/cmijum","followers_url":"https://api.github.com/users/cmijum/followers","following_url":"https://api.github.com/users/cmijum/following{/other_user}","gists_url":"https://api.github.com/users/cmijum/gists{/gist_id}","starred_url":"https://api.github.com/users/cmijum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmijum/subscriptions","organizations_url":"https://api.github.com/users/cmijum/orgs","repos_url":"https://api.github.com/users/cmijum/repos","events_url":"https://api.github.com/users/cmijum/events{/privacy}","received_events_url":"https://api.github.com/users/cmijum/received_events","type":"User","site_admin":false},"labels":[{"id":260197529,"url":"https://api.github.com/repos/cloudant/sync-cordova-plugin/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":{"login":"ricellis","id":10698320,"avatar_url":"https://avatars0.githubusercontent.com/u/10698320?v=4","gravatar_id":"","url":"https://api.github.com/users/ricellis","html_url":"https://github.com/ricellis","followers_url":"https://api.github.com/users/ricellis/followers","following_url":"https://api.github.com/users/ricellis/following{/other_user}","gists_url":"https://api.github.com/users/ricellis/gists{/gist_id}","starred_url":"https://api.github.com/users/ricellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricellis/subscriptions","organizations_url":"https://api.github.com/users/ricellis/orgs","repos_url":"https://api.github.com/users/ricellis/repos","events_url":"https://api.github.com/users/ricellis/events{/privacy}","received_events_url":"https://api.github.com/users/ricellis/received_events","type":"User","site_admin":false},"assignees":[{"login":"ricellis","id":10698320,"avatar_url":"https://avatars0.githubusercontent.com/u/10698320?v=4","gravatar_id":"","url":"https://api.github.com/users/ricellis","html_url":"https://github.com/ricellis","followers_url":"https://api.github.com/users/ricellis/followers","following_url":"https://api.github.com/users/ricellis/following{/other_user}","gists_url":"https://api.github.com/users/ricellis/gists{/gist_id}","starred_url":"https://api.github.com/users/ricellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricellis/subscriptions","organizations_url":"https://api.github.com/users/ricellis/orgs","repos_url":"https://api.github.com/users/ricellis/repos","events_url":"https://api.github.com/users/ricellis/events{/privacy}","received_events_url":"https://api.github.com/users/ricellis/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/cloudant/sync-cordova-plugin/milestones/5","html_url":"https://github.com/cloudant/sync-cordova-plugin/milestone/5","labels_url":"https://api.github.com/repos/cloudant/sync-cordova-plugin/milestones/5/labels","id":2688123,"number":5,"title":"0.4.1","description":"","creator":{"login":"ricellis","id":10698320,"avatar_url":"https://avatars0.githubusercontent.com/u/10698320?v=4","gravatar_id":"","url":"https://api.github.com/users/ricellis","html_url":"https://github.com/ricellis","followers_url":"https://api.github.com/users/ricellis/followers","following_url":"https://api.github.com/users/ricellis/following{/other_user}","gists_url":"https://api.github.com/users/ricellis/gists{/gist_id}","starred_url":"https://api.github.com/users/ricellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricellis/subscriptions","organizations_url":"https://api.github.com/users/ricellis/orgs","repos_url":"https://api.github.com/users/ricellis/repos","events_url":"https://api.github.com/users/ricellis/events{/privacy}","received_events_url":"https://api.github.com/users/ricellis/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":5,"state":"open","created_at":"2017-08-08T13:28:13Z","updated_at":"2017-08-15T10:35:35Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2017-08-04T04:20:12Z","updated_at":"2017-08-15T12:10:14Z","closed_at":"2017-08-11T08:19:41Z","body":"Hi Team I find an issue in the code where the Map.Entry<String, Object> is converted to a JSONObject inside the buildJSON function of CloudantSyncPlugin.java\r\n\r\n```\r\nfor (Map.Entry<String, Object> entry : body.entrySet()) {\r\n            result.put(entry.getKey(), entry.getValue());\r\n}\r\n```\r\n\r\nLets take a multi-level json \r\n```\r\n{\r\n  \"_id\": \"96dbfe3da7d543b106ba6ca324ca5c2d\",\r\n  \"_rev\": \"1-44ab60d541e09bf132206e8553b31621\",\r\n  \"document_type\": \"Vehicle\",\r\n  \"vehicle_types\": [\r\n    {\r\n      \"type\": \"Car\",\r\n      \"model\": \"4 Wheeler\"\r\n    },\r\n    {\r\n      \"type\": \"Bike\",\r\n      \"model\": \"2 Wheeler\"\r\n    }\r\n  ]\r\n}\r\n```\r\nCode that fetches the result : \r\n```\r\nlet query = {\r\n              selector: {\r\n                            document_type: \"Vehicle\",\r\n                        }\r\n            };        \r\nthis.datastore.find(query)\r\n       .then(function(results){\r\n                console.log(\"Results \",results);                         \r\n       }).done();\r\n```\r\nIf you look at the result of it\r\n![image](https://user-images.githubusercontent.com/14971151/28953750-e34c7fa6-78f7-11e7-869b-dbdbbcb38725.png)\r\n\r\nIt has not converted the child entries (vehicle_types) to a proper Json Object.\r\nConvering this \r\n\r\n> \"[{type=Car, model=4 Wheeler}, {type=Bike, model=2 Wheeler}]\"\r\n\r\n back to a json object is again a lengthy process.\r\nCan someone look into this issue and get it fixed\r\n\r\nThanks & Regards,\r\nMiju\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/cloudant/sync-cordova-plugin/issues/comments/322449946","html_url":"https://github.com/cloudant/sync-cordova-plugin/issues/90#issuecomment-322449946","issue_url":"https://api.github.com/repos/cloudant/sync-cordova-plugin/issues/90","id":322449946,"user":{"login":"ricellis","id":10698320,"avatar_url":"https://avatars0.githubusercontent.com/u/10698320?v=4","gravatar_id":"","url":"https://api.github.com/users/ricellis","html_url":"https://github.com/ricellis","followers_url":"https://api.github.com/users/ricellis/followers","following_url":"https://api.github.com/users/ricellis/following{/other_user}","gists_url":"https://api.github.com/users/ricellis/gists{/gist_id}","starred_url":"https://api.github.com/users/ricellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricellis/subscriptions","organizations_url":"https://api.github.com/users/ricellis/orgs","repos_url":"https://api.github.com/users/ricellis/repos","events_url":"https://api.github.com/users/ricellis/events{/privacy}","received_events_url":"https://api.github.com/users/ricellis/received_events","type":"User","site_admin":false},"created_at":"2017-08-15T12:10:14Z","updated_at":"2017-08-15T12:10:14Z","body":"The fix is included in the [0.4.1 release](https://github.com/cloudant/sync-cordova-plugin/releases/tag/0.4.1)."}}
{"actor":{"display_login":"ricellis"}}