Title: Can't deserialize response body from batch request as the json properties are single quoted · Issue #807 · microsoftgraph/msgraph-sdk-python-core · GitHub
Open Graph Title: Can't deserialize response body from batch request as the json properties are single quoted · Issue #807 · microsoftgraph/msgraph-sdk-python-core
X Title: Can't deserialize response body from batch request as the json properties are single quoted · Issue #807 · microsoftgraph/msgraph-sdk-python-core
Description: Describe the bug I'm trying to list applications filtered by particular IDs - there's loads of them so I'm using a batch request with 15 filters at a time (limit). This will allow me to get all the object IDs to query owners etc. When I ...
Open Graph Description: Describe the bug I'm trying to list applications filtered by particular IDs - there's loads of them so I'm using a batch request with 15 filters at a time (limit). This will allow me to get all the...
X Description: Describe the bug I'm trying to list applications filtered by particular IDs - there's loads of them so I'm using a batch request with 15 filters at a time (limit). This will allow me to...
Opengraph URL: https://github.com/microsoftgraph/msgraph-sdk-python-core/issues/807
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Can't deserialize response body from batch request as the json properties are single quoted","articleBody":"### Describe the bug\n\nI'm trying to list applications filtered by particular IDs - there's loads of them so I'm using a batch request with 15 filters at a time (limit). This will allow me to get all the object IDs to query owners etc.\n\nWhen I attempt to deserialize the `BatchResponseContent` object with `get_response_by_id(response_id, ApplicationCollectionResponse)`, I get a stack telling me that it can't decode as the properties are single quoted rather than double quoted.\n\n```\nTraceback (most recent call last):\n File \"/\u003cproject\u003e/.venv/lib/python3.9/site-packages/msgraph_core/requests/batch_response_content.py\", line 126, in response_body\n parse_node = ParseNodeFactoryRegistry().get_root_parse_node(\n File \"/\u003cproject\u003e/.venv/lib/python3.9/site-packages/kiota_abstractions/serialization/parse_node_factory_registry.py\", line 41, in get_root_parse_node\n return factory.get_root_parse_node(vendor_specific_content_type, content)\n File \"/\u003cproject\u003e/.venv/lib/python3.9/site-packages/kiota_abstractions/serialization/parse_node_proxy_factory.py\", line 56, in get_root_parse_node\n node = self._concrete.get_root_parse_node(content_type, content)\n File \"/\u003cproject\u003e/.venv/lib/python3.9/site-packages/kiota_serialization_json/json_parse_node_factory.py\", line 37, in get_root_parse_node\n content_dict = json.loads(content_as_str)\n File \"/usr/lib/python3.9/json/__init__.py\", line 346, in loads\n return _default_decoder.decode(s)\n File \"/usr/lib/python3.9/json/decoder.py\", line 337, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File \"/usr/lib/python3.9/json/decoder.py\", line 353, in raw_decode\n obj, end = self.scan_once(s, idx)\njson.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)\n```\n\nThis is backed up by if I just try to do a `json_loads(response.body.decode('utf-8'))`, which then succeeds if I do a `.replace(\"'\", '\"')`.\n\n### Expected behavior\n\nI should be able to provide the ApplicationCollectionResponse object to BatchResponseContent.get_response_by_id and deserialize the batch response so that I can get the ID out of the response.\n\n### How to reproduce\n\n\n```\n for app_filter in app_filters:\n app_query_params = (\n ApplicationsRequestBuilder.ApplicationsRequestBuilderGetQueryParameters(\n select=[\"appId\", \"id\", \"serviceManagementReference\"],\n filter=f\"appId in {app_filter}\",\n )\n )\n app_request_config = RequestConfiguration(query_parameters=app_query_params)\n \n batch_request_content.add_request_information(\n client.applications.to_get_request_information(\n request_configuration=app_request_config\n ),\n app_filter,\n )\n \n batch_response = await client.batch.post(batch_request_content)\n\n if not batch_response or not batch_response.responses:\n log.error(\"Batch request for application object IDs failed\")\n return None\n\n for response_id in batch_response.responses.keys():\n batch_response.get_response_by_id(response_id, ApplicationCollectionResponse) \n```\n\n\n### SDK Version\n\n1.17.0 of msgraph-sdk (so 1.2.0 of msgraph-core)\n\n### Latest version known to work for scenario above?\n\n_No response_\n\n### Known Workarounds\n\n_No response_\n\n### Debug output\n\n\u003cdetails\u003e\u003csummary\u003eClick to expand log\u003c/summary\u003e\n```\n\n\u003cLog output here\u003e\n\n```\n\u003c/details\u003e\n\n\n### Configuration\n\n_No response_\n\n### Other information\n\n_No response_","author":{"url":"https://github.com/drhar","@type":"Person","name":"drhar"},"datePublished":"2025-01-22T17:13:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/807/msgraph-sdk-python-core/issues/807"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8e0cf93a-a24e-827e-9880-9291aa6d20a9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C3DE:1851F5:32AD9D:4487AF:6969D37E |
| html-safe-nonce | 1538c09d7d41493e011c2a8a4c6123e7f35133eabfa6f1b4ef1c4b49e651f2cf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0RFOjE4NTFGNTozMkFEOUQ6NDQ4N0FGOjY5NjlEMzdFIiwidmlzaXRvcl9pZCI6IjczMzA0MDEyMjkwOTY5OTc3NTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 30bb3997de39c8a17f669c0069180c711f02614cc9a17289b41ab21d1bb63e78 |
| hovercard-subject-tag | issue:2804928885 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoftgraph/msgraph-sdk-python-core/807/issue_layout |
| twitter:image | https://opengraph.githubassets.com/162316107f989380c4117f0fe876bce996bb83531f779fbca423730dee9ab05b/microsoftgraph/msgraph-sdk-python-core/issues/807 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/162316107f989380c4117f0fe876bce996bb83531f779fbca423730dee9ab05b/microsoftgraph/msgraph-sdk-python-core/issues/807 |
| og:image:alt | Describe the bug I'm trying to list applications filtered by particular IDs - there's loads of them so I'm using a batch request with 15 filters at a time (limit). This will allow me to get all the... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | drhar |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoftgraph/msgraph-sdk-python-core git https://github.com/microsoftgraph/msgraph-sdk-python-core.git |
| octolytics-dimension-user_id | 17304259 |
| octolytics-dimension-user_login | microsoftgraph |
| octolytics-dimension-repository_id | 242847794 |
| octolytics-dimension-repository_nwo | microsoftgraph/msgraph-sdk-python-core |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 242847794 |
| octolytics-dimension-repository_network_root_nwo | microsoftgraph/msgraph-sdk-python-core |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width