梦幻之旅

DEBUG - 天道酬勤

   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  671 随笔 :: 6 文章 :: 256 评论 :: 0 Trackbacks
public class Tester
{   
    
public static void main(String[] args) 
    
{   
        Gson gson 
= new Gson();   
        List
<String> testList = new ArrayList<String>();   
        testList.add(
"first");   
        testList.add(
"second");   
        String listToJson 
= gson.toJson(testList);
        System.out.println(listToJson);        
          
        Map
<String, String> testMap = new HashMap<String, String>();   
        testMap.put(
"id""id.first");   
        testMap.put(
"name","name.second");   
        String mapToJson 
= gson.toJson(testMap);   
        System.out.println(mapToJson);   
        
        listToJson 
= gson.toJson(new Worker());   
        System.out.println(listToJson);       
    }
  
}
posted on 2010-11-01 16:08 HUIKK 阅读(259) 评论(0)  编辑  收藏 所属分类: EXT

只有注册用户登录后才能发表评论。


网站导航: