Title: Any.get() method query · Issue #35 · hmkcode/Java · GitHub
Open Graph Title: Any.get() method query · Issue #35 · hmkcode/Java
X Title: Any.get() method query · Issue #35 · hmkcode/Java
Description: Currently, Any API returns .get(...) calls with default values if the specified JSON path does not exist. Consider: String input = '{ "id": 35, "name": "Agatha", "surname": "Christie" }'; Any any = JsonIterator.deserialize(input); System...
Open Graph Description: Currently, Any API returns .get(...) calls with default values if the specified JSON path does not exist. Consider: String input = '{ "id": 35, "name": "Agatha", "surname": "Christie" }'; Any any =...
X Description: Currently, Any API returns .get(...) calls with default values if the specified JSON path does not exist. Consider: String input = '{ "id": 35, "name": "Agatha", &...
Opengraph URL: https://github.com/hmkcode/Java/issues/35
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Any.get() method query","articleBody":"Currently, Any API returns .get(...) calls with default values if the specified JSON path does not exist. Consider:\r\n\r\nString input = '{ \"id\": 35, \"name\": \"Agatha\", \"surname\": \"Christie\" }';\r\nAny any = JsonIterator.deserialize(input);\r\nSystem.out.println(any.get(\"age\").toInt()); --> prints \"0\"\r\nInstead of returning some default values (\"\" for String, 0 for int, etc.), do you think it's sane to have the .get method like this?\r\n\r\nAny.get(Object defaultValue, Object... keys)\r\nSo we could do this:\r\n\r\n`String input = '{ \"id\": 35, \"name\": \"Agatha\", \"surname\": \"Christie\" }';\r\nAny any = JsonIterator.deserialize(input);\r\nSystem.out.println(any.get(26, \"age\").toInt()); --> Since \"age\" key doesn't exist, will print 26\r\n`\r\n","author":{"url":"https://github.com/anmol27katyani","@type":"Person","name":"anmol27katyani"},"datePublished":"2017-09-05T03:29:25Z","url":"https://github.com/hmkcode/Java/issues/35"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:1f5f2c88-953a-c20b-8938-1cf557a58140 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D1A:4B936:68F80:90EB4:6AFD9663 |
| html-safe-nonce | 92bb345df258d7f98dd04e6deb72e239e1504c4761f52ac530fbc941d1c147d8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDFBOjRCOTM2OjY4RjgwOjkwRUI0OjZBRkQ5NjYzIiwidmlzaXRvcl9pZCI6Ijg0MjE3NDU1ODA0MjQyOTAyNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c2bdecb8fa5a44e84fc5607f6be1749592ff747b2a572efc82213b9e70b6551a |
| hovercard-subject-tag | issue:255150871 |
| 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/hmkcode/Java/35/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d42ff4196019f46619dde7a71a5fb610c549fd0711df3c8e3ffb3c04da1e2db3/hmkcode/Java/issues/35 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d42ff4196019f46619dde7a71a5fb610c549fd0711df3c8e3ffb3c04da1e2db3/hmkcode/Java/issues/35 |
| og:image:alt | Currently, Any API returns .get(...) calls with default values if the specified JSON path does not exist. Consider: String input = '{ "id": 35, "name": "Agatha", "surname": "Christie" }'; Any any =... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | anmol27katyani |
| hostname | github.com |
| expected-hostname | github.com |
| None | bc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea |
| turbo-cache-control | no-preview |
| go-import | github.com/hmkcode/Java git https://github.com/hmkcode/Java.git |
| octolytics-dimension-user_id | 3790597 |
| octolytics-dimension-user_login | hmkcode |
| octolytics-dimension-repository_id | 9546965 |
| octolytics-dimension-repository_nwo | hmkcode/Java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9546965 |
| octolytics-dimension-repository_network_root_nwo | hmkcode/Java |
| 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 | 927a6c5ab1c32b38830f1b9d3050c0b9e9aa92e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width