Title: Structure validation: duplicate key · Issue #37 · simdjson/simdjson-java · GitHub
Open Graph Title: Structure validation: duplicate key · Issue #37 · simdjson/simdjson-java
X Title: Structure validation: duplicate key · Issue #37 · simdjson/simdjson-java
Description: If there are duplicate keys in the JSON, the current JSON parser will take the value corresponding to the first occurrence of the key: inputString: public class SimdJsonTest { static final SimdJsonParser SIMD_PARSER = new SimdJsonParser(...
Open Graph Description: If there are duplicate keys in the JSON, the current JSON parser will take the value corresponding to the first occurrence of the key: inputString: public class SimdJsonTest { static final SimdJson...
X Description: If there are duplicate keys in the JSON, the current JSON parser will take the value corresponding to the first occurrence of the key: inputString: public class SimdJsonTest { static final SimdJson...
Opengraph URL: https://github.com/simdjson/simdjson-java/issues/37
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Structure validation: duplicate key","articleBody":"If there are duplicate keys in the JSON, the current JSON parser will take the value corresponding to the first occurrence of the key:\r\n\r\ninputString:\r\n```\r\npublic class SimdJsonTest {\r\n\r\n static final SimdJsonParser SIMD_PARSER = new SimdJsonParser();\r\n static final ObjectMapper JACKSON = new ObjectMapper();\r\n static final Gson GSON = new GsonBuilder().create();\r\n\r\n public static void main(String[] args) throws IOException {\r\n\r\n String json = \"{\\\"num\\\": 2, \\\"num\\\": 123}\";\r\n byte[] bytes = json.getBytes();\r\n JsonValue value = SIMD_PARSER.parse(bytes, bytes.length);\r\n\r\n System.err.println(\"[simd].size = \" + value.getSize()); // 2\r\n System.err.println(\"[simd].num = \" + value.get(\"num\")); // 2\r\n\r\n Map jcsObj = JACKSON.readValue(bytes, Map.class);\r\n System.err.println(\"[jackson].size = \" + jcsObj.size()); // 1\r\n System.err.println(\"[jackson].num = \" + jcsObj.get(\"num\")); // 123\r\n\r\n // will throw exception: com.google.gson.JsonSyntaxException: duplicate key: num\r\n Map gsonObj = GSON.fromJson(new String(bytes), Map.class);\r\n System.err.println(\"[gson].size = \" + gsonObj.size());\r\n System.err.println(\"[gson].num = \" + gsonObj.get(\"num\"));\r\n }\r\n}\r\n```\r\n\r\nThe content of the console output:\r\n\r\n\u003e [simd].size = 2\r\n\u003e [simd].num = 2\r\n\u003e [jackson].size = 1\r\n\u003e [jackson].num = 123\r\n\u003e Exception in thread \"main\" com.google.gson.JsonSyntaxException: duplicate key: num\r\n\u003e ...\r\n","author":{"url":"https://github.com/GeTOUO","@type":"Person","name":"GeTOUO"},"datePublished":"2024-01-08T02:43:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/37/simdjson-java/issues/37"}
| 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:b5b64d88-2477-8d68-99e1-d4319dc2a6ff |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE64:26464B:3D31C8:55183F:6993013C |
| html-safe-nonce | 50ad27b1871e9b01885c62d15c56caabefa1027fee431c0cd8fafd5899e86c88 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTY0OjI2NDY0QjozRDMxQzg6NTUxODNGOjY5OTMwMTNDIiwidmlzaXRvcl9pZCI6IjQwMzIxMzY2MjgwNjM2MzM3MjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 74be408cf8f21fee7ee1354ac5bbf25b82ce0d5f14c859499e69b9645b65375b |
| hovercard-subject-tag | issue:2069503096 |
| 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/simdjson/simdjson-java/37/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9d58f81bd29f531fdbb5e57a054df40fde91d7443e72ed33dac56b0e3433bc1d/simdjson/simdjson-java/issues/37 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9d58f81bd29f531fdbb5e57a054df40fde91d7443e72ed33dac56b0e3433bc1d/simdjson/simdjson-java/issues/37 |
| og:image:alt | If there are duplicate keys in the JSON, the current JSON parser will take the value corresponding to the first occurrence of the key: inputString: public class SimdJsonTest { static final SimdJson... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | GeTOUO |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bae9c7d08ea14e1ee9576041777790e900aa7d28044a68c6b15fb7dc65e3f07 |
| turbo-cache-control | no-preview |
| go-import | github.com/simdjson/simdjson-java git https://github.com/simdjson/simdjson-java.git |
| octolytics-dimension-user_id | 62337925 |
| octolytics-dimension-user_login | simdjson |
| octolytics-dimension-repository_id | 664918257 |
| octolytics-dimension-repository_nwo | simdjson/simdjson-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 664918257 |
| octolytics-dimension-repository_network_root_nwo | simdjson/simdjson-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 | 798a84aab1a6de4380a21ddb59c23208a5b05d45 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width