How do I create a valid atlas_doc_format string from a JSON?

If I get the body of a page through the API and I want it in JSON format, I have to ask for atlas_doc_format and I get the body as a string, which starts with:

  "body": {
    "atlas_doc_format": {
      "value": "{\"type\":\"doc\",...

To use it I can get JSON.parse to transform it:

  "body": {
    "atlas_doc_format": {
      "value": {
        "type": "doc",

My question is this: how do I get the value for this value: key back in the atlas_doc_format single string form with the escaped characters (double quotes, maybe more?)?

Boy, I could have realised this sooner.

Use multiple JSON.stringify calls, e.g. JSON.stringify(JSON.stringify(myVar))