Package org.json

Examples of org.json.JSONStringer.object()


   {
      PrintWriter printWriter = new PrintWriter(outputStream);
      try
      {
         JSONStringer json = new JSONStringer();
         json.object().key("description").value(model.getDescription());
         json.key("children").array();
         for (String child : model.getChildren())
         {
            json.object().key("name").value(child);
            NamedDescription nd = model.getChildDescription(child);
View Full Code Here


         JSONStringer json = new JSONStringer();
         json.object().key("description").value(model.getDescription());
         json.key("children").array();
         for (String child : model.getChildren())
         {
            json.object().key("name").value(child);
            NamedDescription nd = model.getChildDescription(child);
            if (nd != null)
            {
               json.key("description").value(nd.getDescription());
            }
View Full Code Here

            json.endObject();
         }
         json.endArray().key("operations").array();
         for (NamedDescription nd : model.getOperations())
         {
            json.object().key("operation-name").value(nd.getName()).key("operation-description").value(nd.getDescription()).endObject();
         }
         json.endArray().endObject();

         printWriter.write(new JSONObject(json.toString()).toString(3));
         printWriter.flush();
View Full Code Here

        String lData = null;
        try {
          JSONStringer jsonStringer = new JSONStringer();
          // start main object
          jsonStringer.object();
          // iterate through all items (fields) of the token
          Iterator<String> lIterator = sharedObjects.getKeys().iterator();
          while (lIterator.hasNext()) {
            String lKey = lIterator.next();
            Object lVal = sharedObjects.get(lKey);
View Full Code Here

    {
        final JSONStringer js = new JSONStringer();
        js.array();
        for (final Info info : MidiSystem.getMidiDeviceInfo())
        {
            js.object();
            js.key("name").value(info.getName());
            js.key("description").value(info.getDescription());
            js.key("vendor").value(info.getVendor());
            js.key("version").value(info.getVersion());
            js.endObject();
View Full Code Here

    public void send(final MidiMessage message, final long timeStamp)
    {
        try
        {
            final JSONStringer json = new JSONStringer();
            json.object();
            json.key("status").value(message.getStatus());
            json.key("message");
            json.array();
            final byte[] data = message.getMessage();
            final int max = Math.min(data.length, message.getLength());
View Full Code Here

   {
      PrintWriter printWriter = new PrintWriter(outputStream);
      try
      {
         JSONStringer json = new JSONStringer();
         json.object().key("description").value(model.getDescription());
         json.key("children").array();
         for (String child : model.getChildren())
         {
            json.object().key("name").value(child);
            NamedDescription nd = model.getChildDescription(child);
View Full Code Here

         JSONStringer json = new JSONStringer();
         json.object().key("description").value(model.getDescription());
         json.key("children").array();
         for (String child : model.getChildren())
         {
            json.object().key("name").value(child);
            NamedDescription nd = model.getChildDescription(child);
            if (nd != null)
            {
               json.key("description").value(nd.getDescription());
            }
View Full Code Here

            json.endObject();
         }
         json.endArray().key("operations").array();
         for (NamedDescription nd : model.getOperations())
         {
            json.object().key("operation-name").value(nd.getName()).key("operation-description").value(nd.getDescription()).endObject();
         }
         json.endArray().endObject();

         JSONObject output = new JSONObject(json.toString());
         if (pretty)
View Full Code Here

  public static Worksheet createJsonWithFunnyCharacters(Workspace workspace) {
    try {

      JSONStringer x = new JSONStringer();
      String html = "<ul><li>item 1</li></ul>";
      x.object().key("double quote")
          .value("string with \"double quotes\"")
          .key("single quotes")
          .value("'starts has ' and \"ends\" with '").key("tabs")
          .value("there is a tab between \"x\" and \"y\": x\ty")
          .key("newlines").value("there sho\nuld be a newline")
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.