From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.1 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id A2FCE1F453 for ; Wed, 23 Jan 2019 17:10:33 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 139C612188D; Thu, 24 Jan 2019 02:10:30 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id D688D1211E0 for ; Thu, 24 Jan 2019 02:10:27 +0900 (JST) Received: by filter0004p3iad2.sendgrid.net with SMTP id filter0004p3iad2-22386-5C489FFF-5B 2019-01-23 17:10:23.912929536 +0000 UTC m=+763378.632470957 Received: from herokuapp.com (ec2-54-211-52-65.compute-1.amazonaws.com [54.211.52.65]) by ismtpd0050p1mdw1.sendgrid.net (SG) with ESMTP id JtLoOe4dTNyD3cJkP3R3oA for ; Wed, 23 Jan 2019 17:10:23.907 +0000 (UTC) Date: Wed, 23 Jan 2019 17:10:24 +0000 (UTC) From: keystonelemur@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 66681 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15541 X-Redmine-Issue-Author: baweaver X-Redmine-Sender: baweaver X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS4knArr6zsMsqrVuDrwO9zYoJRa6rDlgtuujW LPd3vaF2LjhwenER7mLU8F1t5J7hacOl+VKtpnNNAVj7V8YFeq6tC7vut9dKRDD5zyAMa9ApDjwt5Y Ne2HMbHxzmpBXRXvfpwM/O6JS7GU0G/1W/RwjwruXg+wgZqZHdREXg4CNw== X-ML-Name: ruby-core X-Mail-Count: 91233 Subject: [ruby-core:91233] [Ruby trunk Feature#15541] Add alias symbolize_keys for symbolize_names kwarg for JSON.parse X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #15541 has been updated by baweaver (Brandon Weaver). shevegen (Robert A. Heiler) wrote: > Personally I think that alias name would make sense. With a new alias the backwards > behaviour would also be retained. An alias would probably be best as otherwise it would cause breaking changes, and I think we'd rather avoid that. ---------------------------------------- Feature #15541: Add alias symbolize_keys for symbolize_names kwarg for JSON.parse https://bugs.ruby-lang.org/issues/15541#change-76479 * Author: baweaver (Brandon Weaver) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- https://github.com/ruby/psych/issues/341 When trying to symbolize keys on JSON parsing, it's really hard to remember the name `symbolize_names`: ``` JSON.parse(data, symbolize_names: true) ``` I would like to propose that we change this keyword to `symbolize_keys` to be more clear: ``` JSON.parse(data, symbolize_keys: true) ``` The documentation for this method also reflects the confusion: http://ruby-doc.org/stdlib-2.6/libdoc/json/rdoc/JSON.html#method-i-parse-21 ``` symbolize_names: If set to true, returns symbols for the names (keys) in a JSON object. Otherwise strings are returned. Strings are the default. ``` The same issue came up in Psych not too long ago: https://github.com/ruby/psych/issues/341 I believe the current name causes confusion. Would it be possible to add an alias to this keyword for clarity? -- https://bugs.ruby-lang.org/