Title: `ConvertTo-Json`: terminate cut off branches with a ellipsis string rather than a full (.Net) type name · Issue #8381 · PowerShell/PowerShell · GitHub
Open Graph Title: `ConvertTo-Json`: terminate cut off branches with a ellipsis string rather than a full (.Net) type name · Issue #8381 · PowerShell/PowerShell
X Title: `ConvertTo-Json`: terminate cut off branches with a ellipsis string rather than a full (.Net) type name · Issue #8381 · PowerShell/PowerShell
Description: This enhancement request is related to: Make ConvertTo-Json detect circular references In ConvertTo-Json the max allowed depth is 100. However, we should add code to dynamically check if we are running out of stack, and serialize objects...
Open Graph Description: This enhancement request is related to: Make ConvertTo-Json detect circular references In ConvertTo-Json the max allowed depth is 100. However, we should add code to dynamically check if we are run...
X Description: This enhancement request is related to: Make ConvertTo-Json detect circular references In ConvertTo-Json the max allowed depth is 100. However, we should add code to dynamically check if we are run...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/8381
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`ConvertTo-Json`: terminate cut off branches with a ellipsis string rather than a full (.Net) type name","articleBody":"This enhancement request is related to:\r\n[Make ConvertTo-Json detect circular references](https://github.com/PowerShell/PowerShell/issues/6638)\r\n[In ConvertTo-Json the max allowed depth is 100. However, we should add code to dynamically check if we are running out of stack, and serialize objects with bigger depths](\r\nhttps://github.com/PowerShell/PowerShell/issues/3181)\r\n\r\nApparently almost every programmer goes through the pitfall of the default limited `-Depth` of the `ConvertTo-Json` cmdlet,\r\nSee Sackoverflow: [Unexpected ConvertTo-Json results? Answer: it has a default -Depth of 2](https://stackoverflow.com/questions/53583677/unexpected-convertto-json-results-answer-it-has-a-default-depth-of-2)\r\n\r\nI guess this goes along with the fact that `ConvertTo-Json` terminates branches that are deeper than the default `-Depth` (2) with a (.Net) full type name. Therefore programmers assume a bug or a cmdlet limitation and do not read the help or about. \r\nTo my opinion, adding a full type name to a terminated branch doesn’t add much value, knowing that:\r\n- Json hardly preserves any (.Net) type names at all\r\n- You can’t rebuild the object from the type name without its data.\r\n\r\nMeaning, that a simple [ellipsis]( https://en.wikipedia.org/wiki/Ellipsis) (three dots: `...`) at the end of the cut off branch could suffice and have a clearer meaning that indicates an *intentional* omission of additional child properties.\r\n\r\nDefinition of an ellipsis (from [Wikipedia]( https://en.wikipedia.org/wiki/Ellipsis)):\r\n\r\n\u003e An ellipsis (plural ellipses; from the Ancient Greek: ἔλλειψις, élleipsis, 'omission' or 'falling short') is a series of dots (typically three, such as `…`) that usually indicates an intentional omission of a word, sentence, or whole section from a text without altering its original meaning.\r\n\r\nFor compatibility, I would not use the Unicode ellipses character (U+2026) but simply 3 (ascii) dots: …\r\n\r\nTaken the following commands:\r\n```\r\n$Test = @{Guid = New-Guid}\r\n$Test.Parent = $Test\r\n$Test | ConvertTo-Json\r\n```\r\nIn stead of producing:\r\n```\r\n{\r\n \"Guid\": \"a274d017-5188-4d91-b960-023c06159dcc\",\r\n \"Parent\": {\r\n \"Guid\": \"a274d017-5188-4d91-b960-023c06159dcc\",\r\n \"Parent\": {\r\n \"Guid\": \"a274d017-5188-4d91-b960-023c06159dcc\",\r\n \"Parent\": \"System.Collections.Hashtable\"\r\n }\r\n }\r\n}\r\n```\r\nIt should produce:\r\n```\r\n{\r\n \"Guid\": \"a274d017-5188-4d91-b960-023c06159dcc\",\r\n \"Parent\": {\r\n \"Guid\": \"a274d017-5188-4d91-b960-023c06159dcc\",\r\n \"Parent\": {\r\n \"Guid\": \"a274d017-5188-4d91-b960-023c06159dcc\",\r\n \"Parent\": \"...\"\r\n }\r\n }\r\n}\r\n```","author":{"url":"https://github.com/iRon7","@type":"Person","name":"iRon7"},"datePublished":"2018-12-02T18:40:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/8381/PowerShell/issues/8381"}
| 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:f51f9ad7-0120-0a7f-becf-136713f60c33 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE24:10A69F:484090:6116ED:6A553E6D |
| html-safe-nonce | bc24363d5baa754c7da9d998cd343182ee885e27e094cc48171dfa4c930256c9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTI0OjEwQTY5Rjo0ODQwOTA6NjExNkVEOjZBNTUzRTZEIiwidmlzaXRvcl9pZCI6IjYxMjMwMDU5NzU2ODU1NzgzNDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fbe0b7a25d73a1b7b02e79e7a128994660a4c9034969e5a5ec89ebeecd102786 |
| hovercard-subject-tag | issue:386586672 |
| 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/PowerShell/PowerShell/8381/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e9130759b93cf58414891d63c396baa8c54d0324f0809835791b0f9f8ed8c42c/PowerShell/PowerShell/issues/8381 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e9130759b93cf58414891d63c396baa8c54d0324f0809835791b0f9f8ed8c42c/PowerShell/PowerShell/issues/8381 |
| og:image:alt | This enhancement request is related to: Make ConvertTo-Json detect circular references In ConvertTo-Json the max allowed depth is 100. However, we should add code to dynamically check if we are run... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | iRon7 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cd9eea424140838b22e9eabd53d92b5702617ddd6d76efcd3a37f08d44309ca5 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| 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 | 3084b9f587e8f1e19803bbe0c77ac77ce3c99c5c |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width