Example usage for org.json.simple JSONObject toString

List of usage examples for org.json.simple JSONObject toString

Introduction

In this page you can find the example usage for org.json.simple JSONObject toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:XBMCmote.java

@Command
public String back() {
    JSONObject request = XBMC.inputBack;

    String response = XBMC.sendCommand(request);

    return String.format("%s\n%s", request.toString(), response);
}

From source file:XBMCmote.java

@Command
public String home() {
    JSONObject request = XBMC.inputHome;

    String response = XBMC.sendCommand(request);

    return String.format("%s\n%s", request.toString(), response);
}

From source file:XBMCmote.java

@Command
public String info() {
    JSONObject request = XBMC.inputInfo;

    String response = XBMC.sendCommand(request);

    return String.format("%s\n%s", request.toString(), response);
}

From source file:XBMCmote.java

@Command
public String playPause() {
    JSONObject request = XBMC.playPause;

    String response = XBMC.sendCommand(request);

    return String.format("%s\n%s", request.toString(), response);
}

From source file:di.uniba.it.tee2.api.v1.GetDocument.java

@GET
public Response search(@PathParam("docid") String docid) {
    try {//w ww  .ja va 2s.c o m
        SearchServiceWrapper instance = SearchServiceWrapper.getInstance(
                ServerConfig.getInstance().getProperty("search.language"),
                ServerConfig.getInstance().getProperty("search.index"));
        Document document = instance.getSearch().getDocument(docid);
        JSONObject json = new JSONObject();
        json.put("id", document.get("id"));
        json.put("title", document.get("title"));
        json.put("content", document.get("content"));
        return Response.ok(json.toString()).build();
    } catch (Exception ex) {
        Logger.getLogger(GetDocument.class.getName()).log(Level.SEVERE, null, ex);
        return Response.serverError().build();
    }
}

From source file:XBMCmote.java

@Command
public String right() {
    JSONObject request = XBMC.inputRight;

    String response = XBMC.sendCommand(request);

    return String.format("%s\n%s", request.toString(), response);
}

From source file:com.eduardojanuario.comente.controller.ComentarioController.java

/**
 * Trata e retorna o assunto// w  ww . j  a v  a 2 s .  c  o m
 * 
 */
@Path("/")
@Post
public void assunto(String assunto) {

    String url = Tratador.geraUrlParamAmigavel(assunto);

    JSONObject retorno = new JSONObject();
    retorno.put("retorno", "ok");
    retorno.put("url", url);

    result.use(Results.http()).body(retorno.toString());
}

From source file:XBMCmote.java

@Command
public String select() {
    JSONObject request = XBMC.inputSelect;

    String response = XBMC.sendCommand(request);

    return String.format("%s\n%s", request.toString(), response);
}

From source file:XBMCmote.java

@Command
public String menu() {
    JSONObject request = XBMC.inputContextMenu;

    String response = XBMC.sendCommand(request);

    return String.format("%s\n%s", request.toString(), response);
}

From source file:mediasearch.twitter.TwitterService.java

private ArrayList<TwitterTweet> parseJsonIntoTweets(JSONObject object) {
    GsonBuilder gsonBuilder = new GsonBuilder();
    gsonBuilder.registerTypeAdapter(String.class, new NullJsonStringConverter());
    gsonBuilder.serializeNulls();//from  w w w.  j  a v a 2s .  c o m
    Gson gson = gsonBuilder.create();

    JSONArray array = (JSONArray) object.get("statuses");
    for (int i = 0; i < array.size(); i++) {
        JSONObject jSONObject = (JSONObject) array.get(i);
        TwitterTweet tweet = gson.fromJson(jSONObject.toString(), TwitterTweet.class);
        ret.add(tweet);
    }

    return ret;
}