# How do I create a valid atlas\_doc\_format string from a JSON?

**URL:** <https://community.developer.atlassian.com/t/how-do-i-create-a-valid-atlas-doc-format-string-from-a-json/68105>\
**Category:** Forge Platform and Tools\
**Created:** [April 1, 2023, 11:18am UTC](https://community.developer.atlassian.com/t/how-do-i-create-a-valid-atlas-doc-format-string-from-a-json/68105 "2023-04-01T11:18:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GerbenWierda](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/gerbenwierda/32/47477_2.png) [@GerbenWierda](https://community.developer.atlassian.com/u/GerbenWierda)\
**Post date:** [April 1, 2023, 11:18am UTC](https://community.developer.atlassian.com/t/how-do-i-create-a-valid-atlas-doc-format-string-from-a-json/68105/1 "2023-04-01T11:18:45Z")

</div>

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:

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

```

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

```auto
  "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?)?

---

<div class="post-metadata">

**Author:** ![GerbenWierda](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/gerbenwierda/32/47477_2.png) [@GerbenWierda](https://community.developer.atlassian.com/u/GerbenWierda)\
**Post date:** [April 1, 2023, 11:36am UTC](https://community.developer.atlassian.com/t/how-do-i-create-a-valid-atlas-doc-format-string-from-a-json/68105/2 "2023-04-01T11:36:53Z")

</div>

Boy, I could have realised this sooner.

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