package com.management.bean;

import java.util.List;
import java.util.Map;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;

public class Test {
	public static void main(String[] args) {
		String json = "[{'id':1,'username':'mark','password':'123'},{'id':2,'username':'jim','password':'1223'},]";
		String one = "{'id':1,'username':'mark','password':'123'}";
		
		String books = "[{name:item1,category:学术专著、国家级规划教材,rank:0,words:210351,time:2014-05-14},]";
		Gson gson = new GsonBuilder()  
		  .setDateFormat("yyyy-MM-dd")  
		  .create(); 
		
		List<Admin> as = gson.fromJson(json, new TypeToken<List<Admin>>(){}.getType());
		for (Admin admin : as) {
			System.out.println(admin);
		}
		
		List<Book> bs = gson.fromJson(books, new TypeToken<List<Book>>(){}.getType());
		for (Book book : bs) {
			System.out.println(book);
		}
		
		
		
	}
}
