Let's say I have some convoluted json like so:

```json
{
  "ref": "some",
  "repository": {
    "id": 123456789,
    "name": "foo bar"
  }
}

```

I'm trying to get it into this format:

```
{"ref":"some","repository":{"id":123456789,"name":"foo bar"}}

```

So, no whitespace or newlines except the ones in the json key/value pairs themselves.

`Regex.Replace(myJson, @"\s+", string.Empty)` removes the spaces from `foo bar` resulting in `foobar`.

Using

`JsonConvert.SerializeObject(myJson, Formatting.None)`

Gives me

`{\n \"ref\": \"some\",\n \"repository\": {\n \"id\": 123456789,\n \"name\": \"foo bar\"\n }\n}`

What's another way I can remove all non-essential white spaces and newlines on this json?