⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   Test.java

package org.json.simple;

import java.io.PrintStream;

// Referenced classes of package org.json.simple:
//			JSONArray, JSONObject, JSONValue

public class Test
{

	public Test()
	{
	}

	public static void main(String args[])
		throws Exception
	{
		JSONArray array1 = new JSONArray();
		array1.add("abc\020a/");
		array1.add(new Integer(123));
		array1.add(new Double(122.22D));
		array1.add(new Boolean(true));
		System.out.println("======array1==========");
		System.out.println(array1);
		System.out.println();
		JSONObject obj1 = new JSONObject();
		obj1.put("name", "fang");
		obj1.put("age", new Integer(27));
		obj1.put("is_developer", new Boolean(true));
		obj1.put("weight", new Double(60.210000000000001D));
		obj1.put("array1", array1);
		System.out.println();
		System.out.println("======obj1 with array1===========");
		System.out.println(obj1);
		System.out.println();
		obj1.remove("array1");
		array1.add(obj1);
		System.out.println("======array1 with obj1========");
		System.out.println(array1);
		System.out.println();
		System.out.println("======parse to java========");
		String s = "[0,{\"1\":{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}}]";
		Object obj = JSONValue.parse(s);
		JSONArray array = (JSONArray)obj;
		System.out.println("======the 2nd element of array======");
		System.out.println(array.get(1));
		System.out.println();
		JSONObject obj2 = (JSONObject)array.get(1);
		System.out.println("======field \"1\"==========");
		System.out.println(obj2.get("1"));
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -