zoukankan      html  css  js  c++  java
  • encode_json 会对给定的Perl的数据结构转换为一个UTF-8 encoded, binary string.

    use JSON qw/encode_json decode_json/ ;
    use Encode;
    my $data = [
         {
             'name' => 'Ken' ,
             'age' => 19
         },
         {
             'name' => '测试' ,
             'age' => 25
         }
    ];
    print encode_utf8("'name' => '测试'");
    print "
    ";
    my $json_out = encode_json ( $data );
    print $json_out;
    print "
    ";
    
    
    encode_json  
      
        $json_text = encode_json $perl_scalar  
    Converts the given Perl data structure to a UTF-8 encoded, binary string.  
      
    This function call is functionally identical to:  
      
        $json_text = JSON->new->utf8->encode($perl_scalar)  
    
    
    
    encode_json 会对给定的Perl的数据结构转换为一个UTF-8 encoded, binary string.  

  • 相关阅读:
    Python(多进程multiprocessing模块)
    Python(队列)
    Unique Paths
    Unique Paths
    Jump Game II
    Jump Game
    Path Sum II
    Path Sum
    Remove Element
    Implement strStr()
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350552.html
Copyright © 2011-2022 走看看