Saving two shapefiles into one GeoJSON

GeoJSON can have only one layer.

https://tools.ietf.org/html/rfc7946#section-2

  1. GeoJSON Text

A GeoJSON text is a JSON text and consists of a single GeoJSON object.

  1. GeoJSON Object

A GeoJSON object represents a Geometry, Feature, or collection of Features.

For GDAL and QGIS this means https://gdal.org/drivers/vector/geojson.html

A GeoJSON datasource is translated to single OGRLayer object with pre-defined name OGRGeoJSON:

ogrinfo -ro http://featureserver/data/.geojson OGRGeoJSON

It is also valid to assume that OGRDataSource::GetLayerCount() for GeoJSON datasource always returns 1.