private void writeArray ( JsonGenerator jsonGenerator , Object [ ] array , boolean firstInHierarchy ) throws IOException , SQLException { if ( ! firstInHierarchy ) { jsonGenerator . writeStartArray ( ) ; } for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] instanceof Integer ) { jsonGenerator . writeNumber ( ( int ) array [ i ] ) ; } else if ( array [ i ] instanceof String ) { if ( array [ i ] . equals ( "{}" ) ) { jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeEndObject ( ) ; } else { jsonGenerator . writeString ( ( String ) array [ i ] ) ; } } else if ( array [ i ] instanceof Double ) { jsonGenerator . writeNumber ( ( double ) array [ i ] ) ; } else if ( array [ i ] instanceof Boolean ) { jsonGenerator . writeBoolean ( ( boolean ) array [ i ] ) ; } else if ( array [ i ] instanceof Object [ ] ) { writeArray ( jsonGenerator , ( Object [ ] ) array [ i ] , false ) ; } } if ( ! firstInHierarchy ) { jsonGenerator . writeEndArray ( ) ; } }
Write the array in the geojson