zoukankan      html  css  js  c++  java
  • Json数据,转换规则,

    JSON数据转换,规则是遇见json 中的{},则是数组[],遇见name:value,则是'key'=>'value', 但是不带键值的数组如['xxxxxx'],json_encode后仍然是'["xxxxx"]',若带键值,如['y'=>'xxxxxx'],则会转换为{'y':'xxxxxxxx'}这样的形式,完整例子,比如下面的可以相互转换,

    {
       datas:[{stuid:"xxx",
          stuNo:"xxx",
          stuName:"xxx",
          completedSize:"xxx",
          uncompletedSize:"xxx"
          },
          {stuid:"xxx",
          stuNo:"xxx",
          stuName:"xxx",
          completedSize:"xxx",
          uncompletedSize:"xxx"
          }
       ],   
       page:{currpage:1,pageNo:"xxx",totals:"xxx"}
    }

    如果组织数据则是[

                             'datas'=>[

                                            0=>[

                                                      'stuid'=>'xxxxx',

                                                      'stuNo'=>'xxxxxxxx',

                                                       'stuName'=>'xxxxxxxxxxxxx',

                                                       'completedSize=>'xxxxxxxx',

                                                       'uncompleteSize'=>'xxxxxxxxxxxx',

                                                 ],

                                              1=>[

                                                      'stuid'=>'xxxxx',

                                                      'stuNo'=>'xxxxxxxx',

                                                       'stuName'=>'xxxxxxxxxxxxx',

                                                       'completedSize=>'xxxxxxxx',

                                                       'uncompleteSize'=>'xxxxxxxxxxxx',

                                                 ]

                                             ]

                                 'page'=>[

                                                        currentPage=>'1',

                                                        pageNo=>'xxxx',

                                                        totals=>'x',

                                              ]

                          ]

  • 相关阅读:
    window.open
    GetPostBackClientHyperlink
    引发和使用事件
    浅谈宝宝的教育及培养
    C#关键字之:base、this
    Ioc
    自定义input[type="radio"]的样式
    选择_冒泡_直接插入排序.md
    Tkinter.md
    从零开始学wordpress 之一
  • 原文地址:https://www.cnblogs.com/musings/p/5530813.html
Copyright © 2011-2022 走看看