code: private JsonElement toElement(final Object value) {
  
  		if (value != null) {
  
  			if (value instanceof String) {
  
  				return new JsonPrimitive((String)value);
  
  			} else if (value instanceof Number) {
  
  				return new JsonPrimitive((Number)value);
  
  			} else if (value instanceof Boolean) {
  
  				return new JsonPrimitive((Boolean)value);
  
  			} else if (value.getClass().isArray()) {
  
  				final JsonArray arr   = new JsonArray();
  				final Object[] values = (Object[])value;
  
  				for (final Object v : values) {
  					arr.add(toElement(v));
  				}
  
  				return arr;
  
  			} else {
  
  				return new JsonPrimitive(value.toString());
  			}
  		}
  
  		return JsonNull.INSTANCE;
  	}
docs: ----- private methods -----