// Path: src/main/java/org/cytoscape/rest/internal/resource/JsonTags.java
// public class JsonTags {
// 
// 	
// 	// For JSON
// 	
// 	public static final String TITLE = "title";
// 	public static final String PUBLIC = "public";
// 	public static final String MUTABLE = "mutable";
// 	public static final String PRIMARY_KEY = "primaryKey";
// 	public static final String ROWS = "rows";
// 	
// 	public static final String COUNT = "count";
// 	
// 	public static final String COLUMN_NAME = "name";
// 	public static final String COLUMN_NAME_OLD = "oldName";
// 	public static final String COLUMN_NAME_NEW = "newName";
// 	public static final String COLUMN_TYPE = "type";
// 	public static final String COLUMN_VALUES = "values";
// 	public static final String COLUMN_IMMUTABLE = "immutable";
// 	public static final String COLUMN_IS_LIST = "list";
// 	public static final String COLUMN_IS_LOCAL = "local";
// 	
// 	public static final String TABLE_FORMAT = "format";
// 	
// 	public static final String SOURCE = "source";
// 	public static final String TARGET= "target";
// 	public static final String DIRECTED = "directed";
// 	
// 	public static final String NETWORK_SUID = "networkSUID";
// 	
// 	public static final String URL = "url";
// 	public static final String FORMAT_EDGELIST = "edgelist";
// 	
// 	
// 	
// }


import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.cytoscape.model.CyColumn;
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyIdentifiable;
import org.cytoscape.model.CyRow;
import org.cytoscape.rest.internal.resource.JsonTags;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonGenerator;
		JsonGenerator generator = null;
		generator = factory.createGenerator(stream);

		generator.writeStartArray();
		for (final CyRow row : rows) {
			generator.writeStartObject();
			serializeSingleRow(generator, row);
			generator.writeEndObject();
		}
		generator.writeEndArray();

		generator.close();
		result = stream.toString("UTF-8");
		stream.close();
		return result;
	}


	public final String serializeColumns(final Collection<CyColumn> columns) throws IOException {

		final JsonFactory factory = new JsonFactory();

		String result = null;
		ByteArrayOutputStream stream = new ByteArrayOutputStream();
		JsonGenerator generator = null;
		generator = factory.createGenerator(stream);

		generator.writeStartArray();
		for (final CyColumn column : columns) {
			generator.writeStartObject();
// Path: src/main/java/org/cytoscape/rest/internal/resource/JsonTags.java
// public class JsonTags {
// 
// 	
// 	// For JSON
// 	
// 	public static final String TITLE = "title";
// 	public static final String PUBLIC = "public";
// 	public static final String MUTABLE = "mutable";
// 	public static final String PRIMARY_KEY = "primaryKey";
// 	public static final String ROWS = "rows";
// 	
// 	public static final String COUNT = "count";
// 	
// 	public static final String COLUMN_NAME = "name";
// 	public static final String COLUMN_NAME_OLD = "oldName";
// 	public static final String COLUMN_NAME_NEW = "newName";
// 	public static final String COLUMN_TYPE = "type";
// 	public static final String COLUMN_VALUES = "values";
// 	public static final String COLUMN_IMMUTABLE = "immutable";
// 	public static final String COLUMN_IS_LIST = "list";
// 	public static final String COLUMN_IS_LOCAL = "local";
// 	
// 	public static final String TABLE_FORMAT = "format";
// 	
// 	public static final String SOURCE = "source";
// 	public static final String TARGET= "target";
// 	public static final String DIRECTED = "directed";
// 	
// 	public static final String NETWORK_SUID = "networkSUID";
// 	
// 	public static final String URL = "url";
// 	public static final String FORMAT_EDGELIST = "edgelist";
// 	
// 	
// 	
// }


// Path: src/main/java/org/cytoscape/rest/internal/serializer/GraphObjectSerializer.java
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.cytoscape.model.CyColumn;
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyIdentifiable;
import org.cytoscape.model.CyRow;
import org.cytoscape.rest.internal.resource.JsonTags;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonGenerator;

		JsonGenerator generator = null;
		generator = factory.createGenerator(stream);

		generator.writeStartArray();
		for (final CyRow row : rows) {
			generator.writeStartObject();
			serializeSingleRow(generator, row);
			generator.writeEndObject();
		}
		generator.writeEndArray();

		generator.close();
		result = stream.toString("UTF-8");
		stream.close();
		return result;
	}


	public final String serializeColumns(final Collection<CyColumn> columns) throws IOException {

		final JsonFactory factory = new JsonFactory();

		String result = null;
		ByteArrayOutputStream stream = new ByteArrayOutputStream();
		JsonGenerator generator = null;
		generator = factory.createGenerator(stream);

		generator.writeStartArray();
		for (final CyColumn column : columns) {
			generator.writeStartObject();
			generator.writeStringField(JsonTags.COLUMN_NAME, column.getName());