Codota Logo
JSONArray.toString
Code IndexAdd Codota to your IDE (free)

How to use
toString
method
in
org.json.simple.JSONArray

Best Java code snippets using org.json.simple.JSONArray.toString (Showing top 20 results out of 405)

  • Common ways to obtain JSONArray
private void myMethod () {
JSONArray j =
  • Codota Iconnew JSONArray()
  • Codota IconJSONObject json;Object object;(JSONArray) json.get(object)
  • Codota IconString s;(JSONArray) JSONValue.parse(s)
  • Smart code suggestions by Codota
}
origin: pentaho/pentaho-kettle

@SuppressWarnings( "unchecked" )
public String getDatabases() {
 JSONArray list = new JSONArray();
 for ( int i = 0; i < repositoriesMeta.nrDatabases(); i++ ) {
  JSONObject databaseJSON = new JSONObject();
  databaseJSON.put( "name", repositoriesMeta.getDatabase( i ).getName() );
  list.add( databaseJSON );
 }
 return list.toString();
}
origin: pentaho/pentaho-kettle

@SuppressWarnings( "unchecked" )
public String getPlugins() {
 List<PluginInterface> plugins = pluginRegistry.getPlugins( RepositoryPluginType.class );
 JSONArray list = new JSONArray();
 for ( PluginInterface pluginInterface : plugins ) {
  if ( !pluginInterface.getIds()[0].equals( "PentahoEnterpriseRepository" ) ) {
   JSONObject repoJSON = new JSONObject();
   repoJSON.put( "id", pluginInterface.getIds()[ 0 ] );
   repoJSON.put( "name", pluginInterface.getName() );
   repoJSON.put( "description", pluginInterface.getDescription() );
   list.add( repoJSON );
  }
 }
 return list.toString();
}
origin: jitsi/jitsi-videobridge

  private static String getJsonString(Collection<String> strings)
  {
    JSONArray array = new JSONArray();
    if (strings != null && !strings.isEmpty())
    {
      array.addAll(strings);
    }
    return array.toString();
  }
}
origin: OpenSOC/opensoc-streaming

private static Put putRequestFromIntel(JSONObject intel) {
  
  Put tempPut = new Put(Bytes.toBytes((String) intel.get("indicator")));
  
  JSONArray intelArray = (JSONArray) intel.get("data");
  
  tempPut.add(Bytes.toBytes("source"),
        Bytes.toBytes((String) intel.get("source")),
        Bytes.toBytes(intelArray.toString()));
  
  return tempPut;
}
/*
origin: mayconbordin/streaminer

@Override
public String toString() {
 return toJSON(new DecimalFormat(Histogram.DEFAULT_FORMAT_STRING)).toString();
}

origin: BiglySoftware/BiglyBT

public static String encodeToJSON(Collection list) {
  return encodeToJSONArray(list).toString();
}
origin: opencast/opencast

public static String toJson(Arr arr) {
 return toJsonSimple(arr).toString();
}
origin: apache/chukwa

 @GET
 @Path("list")
 @Produces("application/javascript")
 public String getUserList() {
  String result = "";
  try {
   result = UserStore.list().toString();
  } catch (IllegalAccessException e) {
   log.error(ExceptionUtil.getStackTrace(e));
   throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)
     .entity("User does not exist.").build());
  }
  return result;
 }
}
origin: apache/chukwa

public String convertObjectsToViewList(JSONObject[] objArray) {
 JSONArray jsonArr = new JSONArray();
 JSONObject permission = new JSONObject();
 JSONObject user = new JSONObject();
 try {
  permission.put("read", 1);
  permission.put("modify", 1);
  user.put("all", permission);
 } catch (Exception e) {
  System.err.println("JSON Exception: " + e.getMessage());
 }
 for (int i = 0; i < objArray.length; i++) {
  try {
   JSONObject jsonObj = new JSONObject();
   jsonObj.put("key", objArray[i].get("key"));
   jsonObj.put("description", objArray[i].get("description"));
   jsonObj.put("owner", "");
   jsonObj.put("permission", user);
   jsonArr.add(jsonObj);
  } catch (Exception e) {
   System.err.println("JSON Exception: " + e.getMessage());
  }
 }
 return jsonArr.toString();
}
origin: BiglySoftware/BiglyBT

public static void toString(StringBuilder sb, String key,Object value){
  sb.append("\"");
  escape(sb,key);
  sb.append("\":");
  if(value==null){
    sb.append("null");
    return;
  }
  if(value instanceof String){
    sb.append("\"");
    escape(sb,(String)value);
    sb.append("\"");
  }else if ( value instanceof JSONObject ){
    ((JSONObject)value).toString( sb );
  }else if ( value instanceof JSONArray ){
    ((JSONArray)value).toString( sb );
  }else{
    sb.append(String.valueOf( value ));
  }
}
origin: com.axway.ats.framework/ats-actionlibrary

@Override
@PublicAtsApi
public String toString() {
  if (jsonObject != null) {
    return jsonObject.toString();
  } else if (jsonArray != null) {
    return jsonArray.toString();
  } else if (javaObject != null) {
    return javaObject.toString();
  } else {
    // this is legal, we are pointing to a NULL value somewhere inside the JSON text
    return null;
  }
}
origin: net.exogeni.orca.handlers/ec2

case users:
  if (users_ != null && users_.size() > 0) {
    return users_.toString();
    return interfaces_.toString();
    return storage_.toString();
    return routes_.toString();
    return scripts_.toString();
origin: BiglySoftware/BiglyBT

  public void toString( StringBuilder sb ){
    sb.append( "[" );

    Iterator<Object> iter=iterator();

    boolean	first = true;
    while(iter.hasNext()){
      if ( first ){
        first = false;
      }else{
        sb.append( "," );
      }
      Object value=iter.next();
      if(value instanceof String){
        sb.append( "\"" );
        JSONObject.escape(sb, (String)value);
        sb.append( "\"");
      }else if ( value instanceof JSONObject ){
        ((JSONObject)value).toString( sb );
      }else if ( value instanceof JSONArray ){
        ((JSONArray)value).toString( sb );
      }else{
        sb.append(String.valueOf(value));
      }
    }

    sb.append( "]" );
  }
}
origin: dice-group/AGDISTIS

  @SuppressWarnings("unchecked")
  public String candidateType(String text, NEDAlgo_HITS agdistis) throws IOException {
    JSONArray arr = new org.json.simple.JSONArray();
    Document d = textToDocument(text);
    Map<NamedEntityInText, List<CandidatesScore>> candidatesPerNE = new HashMap<>();
    agdistis.run(d, candidatesPerNE);
    for (NamedEntityInText namedEntity : candidatesPerNE.keySet()) {
      List<CandidatesScore> candidates = candidatesPerNE.get(namedEntity);
      JSONObject obj = new JSONObject();
      obj.put("namedEntity", namedEntity.getLabel());
      obj.put("Candidates", candidates.toString());
      arr.add(obj);
    }

    log.info("\t" + arr.toString());
    log.info("Finished Request");
    agdistis.close();
    return arr.toString();

  }
}
origin: com.axway.ats.framework/ats-actionlibrary

  plain = jsonObject.toString();
} else if (jsonArray != null) {
  plain = jsonArray.toString();
} else {
  plain = javaObject.toString();
origin: marcelo-mason/PreciousStones

public String getContents() {
  JSONArray out = new JSONArray();
  for (ItemStackEntry entry : contents) {
    out.add(entry.serialize());
  }
  return out.toString();
}
origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.core

/**
 * This returns the json string containing the role permissions for a given API
 *
 * @param connection - DB connection
 * @param apiId      - apiId of the API
 * @return permission string
 * @throws SQLException - if error occurred while getting permissionMap of API from DB
 */
private String getPermissionsStringForApi(Connection connection, String apiId) throws SQLException {
  JSONArray permissionArray = new JSONArray();
  Map<String, Integer> permissionMap = getPermissionMapForApi(connection, apiId);
  for (Map.Entry<String, Integer> entry : permissionMap.entrySet()) {
    JSONObject jsonObject = new JSONObject();
    jsonObject.put(APIMgtConstants.Permission.GROUP_ID, entry.getKey());
    jsonObject.put(APIMgtConstants.Permission.PERMISSION,
        APIUtils.constructApiPermissionsListForValue(entry.getValue()));
    permissionArray.add(jsonObject);
  }
  if (!permissionArray.isEmpty()) {
    return permissionArray.toString();
  } else {
    return "";
  }
}
origin: wso2/carbon-apimgt

/**
 * This returns the json string containing the role permissions for a given API
 *
 * @param connection - DB connection
 * @param apiId      - apiId of the API
 * @return permission string
 * @throws SQLException - if error occurred while getting permissionMap of API from DB
 */
private String getPermissionsStringForApi(Connection connection, String apiId) throws SQLException {
  JSONArray permissionArray = new JSONArray();
  Map<String, Integer> permissionMap = getPermissionMapForApi(connection, apiId);
  for (Map.Entry<String, Integer> entry : permissionMap.entrySet()) {
    JSONObject jsonObject = new JSONObject();
    jsonObject.put(APIMgtConstants.Permission.GROUP_ID, entry.getKey());
    jsonObject.put(APIMgtConstants.Permission.PERMISSION,
        APIUtils.constructApiPermissionsListForValue(entry.getValue()));
    permissionArray.add(jsonObject);
  }
  if (!permissionArray.isEmpty()) {
    return permissionArray.toString();
  } else {
    return "";
  }
}
origin: org.alfresco.surf/spring-surf

sb.append("\n   page: " + location);
sb.append("\n   callerName: "  + callerName);
sb.append("\n   messageArgs: " + messageArgs.toString());
logger.error(sb.toString());
origin: dice-group/AGDISTIS

@SuppressWarnings("unchecked")
public String standardAG(String text, NEDAlgo_HITS agdistis) throws IOException {
  JSONArray arr = new org.json.simple.JSONArray();
  Document d = textToDocument(text);
  agdistis.run(d, null);
  for (NamedEntityInText namedEntity : d.getNamedEntitiesInText()) {
    if(!namedEntity.getNamedEntityUri().contains("http")){
      namedEntity.setNamedEntity("http://aksw.org/notInWiki/" + namedEntity.getSingleWordLabel());
    }
    JSONObject obj = new JSONObject();
    obj.put("namedEntity", namedEntity.getLabel());
    obj.put("start", namedEntity.getStartPos());
    obj.put("offset", namedEntity.getLength());
    obj.put("disambiguatedURL", namedEntity.getNamedEntityUri());
    arr.add(obj);
  }
  log.info("\t" + arr.toString());
  log.info("Finished Request");
  agdistis.close();
  return arr.toString();
}
org.json.simpleJSONArraytoString

Javadoc

Returns a string representation of this array. This is equivalent to calling JSONArray#toJSONString().

Popular methods of JSONArray

  • <init>
    Constructs a JSONArray containing the elements of the specified collection, in the order they are re
  • add
  • size
  • get
  • toJSONString
  • iterator
  • addAll
  • isEmpty
  • toArray
  • writeJSONString
  • contains
  • remove
  • contains,
  • remove,
  • set,
  • clear,
  • forEach,
  • getJsonObject,
  • listIterator,
  • subList

Popular in Java

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • getContentResolver (Context)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Socket (java.net)
    Provides a client-side TCP socket.
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now