toJson

ranges is written only when there are some, so earlier output keeps its bytes.