Method to recurse within children elements and convert them to JSON too.
@param generator
@param element
@param isArray
@throws IOException
357449
private static void convertChildren(JsonGenerator generator, Element element, boolean isArray, ElementNameConverter converter) throws IOException {
        NodeList list = element.getChildNodes();
        int len = list.getLength();
        for (int i = 0; i < len; i++) {
            Node node = list.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                convertElement(generator, (Element) node, isArray, converter);
            }
        }
    }
1174665
public static <T> void writeTo(JsonGenerator generator, T message, Schema<T> schema,
            boolean numeric) throws IOException
    {
        generator.writeStartObject();

        final JsonOutput output = new JsonOutput(generator, numeric, schema);
        schema.writeTo(output, message);
        if (output.isLastRepeated())
            generator.writeEndArray();

        generator.writeEndObject();
    }
740896
@SuppressWarnings("unchecked")
    public final Node<E_OUT> evaluateToArrayNode(IntFunction<E_OUT[]> generator) {
        if (linkedOrConsumed)
            throw new IllegalStateException(MSG_STREAM_LINKED);
        linkedOrConsumed = true;

        // If the last intermediate operation is stateful then
        // evaluate directly to avoid an extra collection step
        if (isParallel() && previousStage != null && opIsStateful()) {
            // Set the depth of this, last, pipeline stage to zero to slice the
            // pipeline such that this operation will not be included in the
            // upstream slice and upstream operations will not be included
            // in this slice
            depth = 0;
            return opEvaluateParallel(previousStage, previousStage.sourceSpliterator(0), generator);
        }
        else {
            return evaluate(sourceSpliterator(0), true, generator);
        }
    }
25049
public void process(OutputStream outputStream, Object element) throws IOException {
        this.root.processElement(outputStream, element);
    }
273841
public void setGenerator(Map<JsonGenerator.Feature, Boolean> generator) {
        if (CollectionUtils.isNotEmpty(generator)) {
            this.generator = generator;
        }
    }
35141
public void loadFromJSON(final InputStream is) throws IOException {
		lock.writeLock().lock();
		try {
			final JsonFactory f = new JsonFactory();
			final JsonParser jp = f.createParser(is);
			configureJsonParser(jp);
			if (jp.nextToken() == JsonToken.START_OBJECT) {
				traverseJSON(jp, null);
			}
		} finally {
			lock.writeLock().unlock();
		}
	}
660997
public void storeToJSON(final OutputStream os) throws IOException {
		lock.readLock().lock();
		try {
			final JsonFactory f = new JsonFactory();
			final JsonGenerator generator = f.createGenerator(os, JsonEncoding.UTF8);
//			generator.configure(Feature.QUOTE_FIELD_NAMES, false);
			generator.useDefaultPrettyPrinter();

			generator.writeStartObject();
			writeJsonOrYaml(generator, getTreeMap());
			generator.writeEndObject();
			generator.flush();
		} finally {
			lock.readLock().unlock();
		}
	}
381059
@SuppressWarnings( "UnusedDeclaration" )
    public void addGenerator( ObjectIdGenerator<?> generator ) {
        if ( null == generators ) {
            generators = new ArrayList<ObjectIdGenerator<?>>();
        }
        generators.add( generator );
    }
224206
private static IGeneratorSet asGeneratorSet( JsonValue json)
    {
    try
      {
      IGeneratorSet generators = null;
      if( json != null && json.getValueType() == OBJECT)
        {
        generators = GeneratorSetJson.asGeneratorSet( (JsonObject) json);
        }

      return generators;
      }
    catch( Exception e)
      {
      throw new ProjectException( "Error reading generators", e);
      }
    }
1012149
private static JsonStructure toJson( ITestCaseGenerator generator)
    {
    JsonObjectBuilder builder = Json.createObjectBuilder();

    if( generator.getClass().equals( TupleGenerator.class))
      {
      TupleGenerator tupleGenerator = (TupleGenerator) generator;
      builder.add( TUPLES_KEY, tupleGenerator.getDefaultTupleSize());
      Optional.ofNullable( tupleGenerator.getRandomSeed()).ifPresent( seed -> builder.add( SEED_KEY, seed));
      
      JsonArrayBuilder combinersBuilder = Json.createArrayBuilder();
      tupleGenerator.getCombiners().stream().forEach( combiner -> combinersBuilder.add( toJson( combiner)));
      JsonArray combiners = combinersBuilder.build();
      if( !combiners.isEmpty())
        {
        builder.add( COMBINERS_KEY, combiners);
        }
      }

    return builder.build();
    }
999727
public static @Nonnull JsonSet set(JsonBuilder... elements) {
        JsonSet jjArray = new JsonSet();
        for (JsonBuilder b : elements) {
            jjArray.add(b);
        }
        return jjArray;
    }
123026
@Override
    protected void writeToOutput(final Map<String, Object> row)
            throws IOException {
        if (generator == null) {
            ObjectMapper mapper = new ObjectMapper();
            JsonFactory factory = new JsonFactory(mapper);
            generator = factory.createGenerator(getWriter());
            generator.writeStartArray(); // [
        }

        // Convert the row into a map
        generator.writeObject(row);
    }
332288
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
		in.defaultReadObject();
		if (this.children != null) {
			final N me = toN();
			for (final NaryTreeNode<D, N> child : this.children) {
				if (child != null) {
					child.setParentNodeReference(me, false);
				}
			}
		}
	}
188436
public static String convertToJson(Node node) throws IOException {
        try (StringWriter writer = new StringWriter(); JsonGenerator generator = new JsonFactory().createGenerator(writer)) {
            convertToJson(node, generator, name -> name);
            return writer.toString();
        }
    }
1034076
public static void write(JsonElement element, JsonWriter writer) throws IOException {
    TypeAdapters.JSON_ELEMENT.write(writer, element);
  }
1324748
public void write(JsonGenerator jsonGenerator) throws IOException {
    // We neither need the list of RequestedNodes, nodes, nor excludedHosts,
    // because we can reconstruct them from the request object
    jsonGenerator.writeStartObject();
    jsonGenerator.writeObjectField("request", request);
    jsonGenerator.writeEndObject();
  }
1367776
static JsonArray getArrayFromJsonElement(JsonElement jsonElement) {
        JsonArray jsonArray = null;
        if (jsonElement.isJsonArray()) {
            jsonArray = jsonElement.getAsJsonArray();
        } else if (jsonElement.isJsonObject() &&
                ((JsonObject) jsonElement).get("results") != null &&
                ((JsonObject) jsonElement).get("results").isJsonArray()) {
            jsonArray = ((JsonObject) jsonElement).get("results").getAsJsonArray();
        }
        return jsonArray;
    }