zoukankan      html  css  js  c++  java
  • C#的JSON开发包 LitJSON

     1 String str = "{’name’:’cyf’,’id’:10,’items’:[{’itemid’:1001,’itemname’:’hello’},{’itemid’:1002,’itemname’:’hello2’}]}";              
     2 //*** 读取JSON字符串中的数据 *******************************            
     3 JsonData jd = JsonMapper.ToObject(str);          
     4 String name = (String)jd["name"];  
     5 long id = (long)jd["id"];            
     6 JsonData jdItems = jd["items"];      
     7 int itemCnt = jdItems.Count; 
     8 // 数组 items 中项的数量 
     9 foreach (JsonData item in jdItems)
    10 // 遍历数组 items            
    11 {int itemID = (int)item["itemid"];                
    12 String itemName = (String)item["itemname"];        
    13 }              
    14 
    15 //*** 将JsonData转换为JSON字符串 ***************************          
    16 
    17 String str2 = jd.ToJson();
     LitJSON 下载地址 :http://litjson.sourceforge.net/
  • 相关阅读:
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Arctic Network POJ
    Truck History POJ
    QS Network ZOJ
  • 原文地址:https://www.cnblogs.com/yimu/p/2687104.html
Copyright © 2011-2022 走看看