Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Date;

public class Main {
    public static JSONObject getLink(String id) throws JSONException {
        Date time = new Date();
        JSONObject obj = new JSONObject();
        obj.put("id", id);
        JSONObject value = new JSONObject();
        value.put("title", "new link");
        value.put("URI", "http://www.foo.com");
        value.put("date", time.getTime());
        JSONArray tags = new JSONArray();
        tags.put("foo");
        value.put("tags", tags);
        obj.put("value", value);
        return obj;
    }
}