json 解析框架 quickjson

码农软件 · 软件分类 · JSON/BSON开发包 · 2019-03-31 10:43:53

软件介绍

quickjson目前版本1.0,大小1.48kb,相对于其他java解析json框架,具有以下特征:

  • 解析速度快

  • json对象转换成java对象和键值对,json数组转换成java数组

  • 无需依赖其他jar,本身很小,几乎可以忽略

  • 无异常抛出

示例:

public class QuickJsonTest {

	@Test
	public void test1() {
		JSONObject jsonObject = (JSONObject) JSON.parse("{\"array\":[1,2,3],\"boolean\":true,\"null\":null,\"number\":123,\"object\":{\"a\":\"b\",\"c\":\"d\",\"e\":\"f\"},\"string\":\"Hello World\"}");
		System.out.println(jsonObject.getStringValue("string"));
		System.out.println(jsonObject.getJSONObject("string"));
	}
	
	@Test
	public void test2() {
		System.out.println(JSON.parse("{\"name\":\"Tom\",\"age\":10,\"address\":\"anhui hfei\"}", A.class));
		System.out.println(JSON.parseJSONObject("{\"name\":\"Tom\",\"age\":10,\"address\":\"anhui hfei\"}").toPojo(A.class));
		System.out.println(JSON.parseJSONArray("[{\"name\":\"Tom\",\"age\":10,\"address\":\"anhui hfei\"}]").getPojoValue(0, A.class));
	}
	
	@Test
	public void test3() {
		System.out.println(JSON.toJSONString(new A("Tom", 11, "anhui hefei")));
		System.out.println(JSON.toJSONString(new int[]{10,10,102,200}));
		HashMap<String, Object> map = new HashMap<String,Object>();
		map.put("name", "Tom");
		map.put("age",11);
		map.put("address", "anhui hefei");
		System.out.println(JSON.toJSONString(map));
		List<String> list = new ArrayList<String>();
		list.add("Tom");
		list.add("jack");
		System.out.println(JSON.toJSONString(list));
	}
}

本文地址:https://codercto.com/soft/d/2542.html

Designing Web Navigation

Designing Web Navigation

James Kalbach / O'Reilly Media / 2007-8-15 / USD 49.99

Thoroughly rewritten for today's web environment, this bestselling book offers a fresh look at a fundamental topic of web site development: navigation design. Amid all the changes to the Web in the pa......一起来看看 《Designing Web Navigation》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具