ãã®è¨äºã¯Perl Advent Calendar 2018ã®10æ¥ç®ã®è¨äºã§ãã JSONãdecodeããæãä¾ãã°ã123ã"123"ã¯åã«å³ããè¨èªã§ããã°ãå¥ã ã«æ±ããããã®ã§ãã ã§ãããPerlã§ã¼ãã£ã¨encodeããã¨ããããããã£ããããã«ãã¦ãã¾ãã¾ãã ä¾ãã°ã次ã®ã³ã¼ãã¯123ã¨encodeããããã¨ãæå¾ ãã¦ãã"123"ã¨encodeãã¾ãã ããã¯ã123ã®perlå é¨ã®å¤ã®ãã©ã°ãæå³ãããæååã«ãªã*1ãencodeããã¦ãã¾ã£ãããã§ãã use JSON::XS; my $row = { id => 123 }; # ã¼ãã£ã¨ hash key ã¨ãã¦è§¦ã my %fg; $fg{$row->{id}} = 1; print encode_json($row); # => { "id":"123" } ããã§ã¯ãåã«å³ããè¨èªã¨ä»²è¯ãã§ãã¾ããã.
{{#tags}}- {{label}}
{{/tags}}