Tabnine Logo
JSONArray.toArray
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: ethereum/ethereumj

private void init(JSONArray jLogs) {
  logs = new ArrayList<>();
  for (Object jLog1 : jLogs) {
    JSONObject jLog = (JSONObject) jLog1;
    byte[] address = Hex.decode((String) jLog.get("address"));
    byte[] data = Hex.decode(((String) jLog.get("data")).substring(2));
    List<DataWord> topics = new ArrayList<>();
    JSONArray jTopics = (JSONArray) jLog.get("topics");
    for (Object t : jTopics.toArray()) {
      byte[] topic = Hex.decode(((String) t));
      topics.add(DataWord.of(topic));
    }
    LogInfo li = new LogInfo(address, topics, data);
    logs.add(li);
  }
}
origin: gradle.plugin.org.mockito/release

private static Collection<String> extractLabels(JSONObject issue) {
  Set<String> out = new HashSet<String>();
  JSONArray labels = (JSONArray) issue.get("labels");
  for (Object o : labels.toArray()) {
    JSONObject label = (JSONObject) o;
    out.add((String) label.get("name"));
  }
  return out;
}
origin: stackoverflow.com

 JSONObject resultsJSONObject = (JSONObject) JSONValue.parse(<<Fetched JSon String>>);
JSONArray dataJSon = (JSONArray) resultsJSONObject.get("data");
JSONObject[] updates = dataJSon.toArray(new JSONObject[dataJSon.size()]);

for (JSONObject update : updates) {
      String message_id = (String) update.get("message_id");
      Integer author_id = (Integer) update.get("author_id");
      Integer createdTime = (Integer) update.get("created_time");
      //Do your own processing...
      //Here you can check null value or not..
}
origin: quintona/storm-r

public Values coerceResponce(JSONArray array){
  return new Values(array.toArray());
}

origin: com.googlecode.redbox-mint/redbox-reports

public JsonObject findJsonObjectWithKey(String keyName) {
  Object[] reportCriteriaOptions = reportCriteriaOptionsJson.getArray(
      "results").toArray();
  for (Object object : reportCriteriaOptions) {
    JsonObject jsonObject = (JsonObject) object;
    if (keyName.equals(jsonObject.get("key"))) {
      return jsonObject;
    }
  }
  return null;
}
origin: dice-group/NLIWOD

for (Object res : resources.toArray()) {
  JSONObject next = (JSONObject) res;
  String namedEntity = (String) next.get("namedEntity");
origin: opencast/opencast

@POST
@Path("removejobs")
@RestQuery(name = "removejobs", description = "Removes all given jobs and their child jobs", returnDescription = "No data is returned, just the HTTP status code", restParameters = { @RestParameter(name = "jobIds", isRequired = true, description = "The IDs of the jobs to delete", type = Type.TEXT), }, reponses = {
    @RestResponse(responseCode = SC_NO_CONTENT, description = "Jobs successfully removed"),
    @RestResponse(responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR, description = "Error while removing jobs") })
public Response removeParentlessJobs(@FormParam("jobIds") String jobIds) throws NotFoundException {
 try {
  final JSONArray array = (JSONArray) JSONValue.parse(jobIds);
  final List<Long> jobIdList = Arrays.asList((Long[]) array.toArray(new Long[0]));
  serviceRegistry.removeJobs(jobIdList);
  return Response.noContent().build();
 } catch (ServiceRegistryException e) {
  throw new WebApplicationException(e);
 }
}
origin: dice-group/NLIWOD

public Map<String, List<Entity>> getEntities(final String question) {
  HashMap<String, List<Entity>> tmp = new HashMap<>();
  try {
    String JSONOutput = doTASK(question);
    JSONParser parser = new JSONParser();
    JSONObject jsonObject = (JSONObject) parser.parse(JSONOutput);
    JSONArray resources = (JSONArray) jsonObject.get("Resources");
    if (resources != null) {
      ArrayList<Entity> tmpList = new ArrayList<>();
      for (Object res : resources.toArray()) {
        JSONObject next = (JSONObject) res;
        Entity ent = new Entity();
        ent.setOffset(Integer.valueOf((String) next.get("@offset")));
        ent.setLabel((String) next.get("@surfaceForm"));
        String uri = ((String) next.get("@URI")).replaceAll(",", "%2C");
        ent.getUris().add(new ResourceImpl(uri));
        for (String type : ((String) next.get("@types")).split(",")) {
          ent.getPosTypesAndCategories().add(new ResourceImpl(type));
        }
        tmpList.add(ent);
      }
      tmp.put("en", tmpList);
    }
  } catch (IOException | ParseException e) {
    log.error("Could not call Spotlight for NER/NED", e);
  }
  return tmp;
}
origin: dice-group/NLIWOD

@Override
public Map<String, List<Entity>> getEntities(final String question) {
  HashMap<String, List<Entity>> tmp = new HashMap<>();
  try {
    String foxJSONOutput = doTASK(question);
    JSONParser parser = new JSONParser();
    JSONObject jsonObject = (JSONObject) parser.parse(foxJSONOutput);
    JSONArray resources = (JSONArray) jsonObject.get("Resources");
    if (resources != null) {
      ArrayList<Entity> tmpList = new ArrayList<>();
      for (Object res : resources.toArray()) {
        JSONObject next = (JSONObject) res;
        Entity ent = new Entity();
        ent.setOffset(Integer.valueOf((String) next.get("@offset")));
        ent.setLabel((String) next.get("@surfaceForm"));
        String uri = ((String) next.get("@URI")).replaceAll(",", "%2C");
        ent.getUris().add(new ResourceImpl(uri));
        for (String type : ((String) next.get("@types")).split(",")) {
          ent.getPosTypesAndCategories().add(new ResourceImpl(type));
        }
        tmpList.add(ent);
      }
      tmp.put("en", tmpList);
    }
  } catch (IOException | ParseException e) {
    log.error("Could not call Spotlight for NER/NED", e);
  }
  return tmp;
}
origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.gateway

if (responseString != null && !responseString.isEmpty()) {
  JSONArray jsonArray = (JSONArray) new JSONParser().parse(responseString);
  return (String[]) jsonArray.toArray(new String[jsonArray.size()]);
origin: com.googlecode.the-fascinator.plugins/plugin-roles-internal

public void setConfig(JsonSimpleConfig config) throws IOException {
  // Get the basics
  file_path   = config.getString(null, "roles", "internal", "path");
  loadRoles();
  JSONArray roleJsonArray = (JSONArray)config.getObject("roles", "internal").get("defaultRoles");
  if(roleJsonArray != null) {
    defaultRoles = Arrays.copyOf(roleJsonArray.toArray(), roleJsonArray.size(), String[].class);
  }
}
origin: com.adobe.ride/ride-model-util

/**
 * Method to retrieve one of the definitions from the anyOf value from a schema node definition
 * 
 * @param propertyObject the node from a schema which has a type of 'AnyOf'
 * @return Object random member definition of the one of the objects in the AnyOf json schema
 *         field.
 */
private Object getOneOfAnyOf(JSONObject propertyObject) {
 Object[] array = ((JSONArray) propertyObject.get("anyOf")).toArray();
 Validate.isTrue(array.length > 0);
 JSONObject nodeDef = (JSONObject) array[DataGenerator.generateRandomInt(0, array.length - 1)];
 Object object = null;;
 try {
  object = generateNodeValue(null, null, nodeDef);
 } catch (ModelSearchException e) {
  e.printStackTrace();
 }
 return object;
}
origin: dice-group/NLIWOD

for (Object res : resources.toArray()) {
  JSONObject next = (JSONObject) res;
  Entity ent = new Entity();
origin: fujitsu-pio/io

  @SuppressWarnings("unchecked")
  private JSONArray skipNullResults(JSONArray source, String propertyName) {
    JSONArray result = new JSONArray();
    for (Object item : source.toArray()) {
      if (((JSONObject) item).get(propertyName) == null) {
        continue;
      }
      result.add(item);
    }
    return result;
  }
}
origin: fujitsu-pio/io

  @SuppressWarnings("unchecked")
  private JSONArray skipNullResults(JSONArray source, String propertyName) {
    JSONArray result = new JSONArray();
    for (Object item : source.toArray()) {
      if (((JSONObject) item).get(propertyName) == null) {
        continue;
      }
      result.add(item);
    }
    return result;
  }
}
origin: activequant/aq2o

} else {
  JSONArray js = (JSONArray) val;
  map.put(key, js.toArray());
  if (js.size() > 0) {
    Object o = js.get(0);
origin: com.adobe.ride/ride-model-util

 logger.log(Level.SEVERE, "A Parse exception was thrown", e);
Object[] enumArray = enums.toArray();
String enumValue =
  enumArray[DataGenerator.generateRandomInt(0, enumArray.length - 1)].toString();
origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

updatePolicyGroups(webAppId, policyGroupIdList.toArray(), connection);
updateJavaPolicies(webAppId, javaPolicyIdList.toArray(), connection);
origin: fujitsu-pio/io

          source.size()));
Object[] expectedArray = source.toArray();
Object[] targetArray = toBeCompared.toArray();
Arrays.sort(expectedArray);
Arrays.sort(targetArray);
origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

if (app.getPolicyPartials() != null && !app.getPolicyPartials().isEmpty()) {
  JSONArray policyPartialIdList = (JSONArray) JSONValue.parse(app.getPolicyPartials());
  saveApplicationPolicyPartialsMappings(connection, webAppId, policyPartialIdList.toArray());
  saveApplicationPolicyGroupsMappings(connection, webAppId, policyGroupIdList.toArray());
  saveJavaPolicyMappings(connection, webAppId, javaPolicyIdList.toArray());
org.json.simpleJSONArraytoArray

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
  • toString
  • writeJSONString
  • contains
  • remove
  • contains,
  • remove,
  • set,
  • clear,
  • forEach,
  • getJsonObject,
  • listIterator,
  • subList

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • findViewById (Activity)
  • compareTo (BigDecimal)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JButton (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now