code: public static @Nonnull JsonArray swapLatLon(@Nonnull JsonArray array) {
          if(array.isNotEmpty() && array.first().isArray()) {
              for(JsonElement e: array) {
                  swapLatLon(e.asArray());
              }
          } else {
              if(array.size() < 2) {
                  throw new IllegalArgumentException("need at least two coordinates");
              }
              JsonElement first = array.get(0);
              JsonElement second = array.get(1);
              array.set(0, second);
              array.set(1, first);
  
          }
          return array;
      }
docs: GeoJson specifies the order of coordinates as x,y or in geo terms longitude followed by latitude.
  Most data sources stick to latitude, longitude though. This function, swaps the two for any dimension array.
  
  
  @param array 2d array with latitude, longitude pairs
  @return swapped array 2d array with longitude, latitude pairs