Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-60329

Code Block Macro doesn't retain JSON formatting in Confluence 7.7.3 and above

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Low
    • None
    • 7.7.3, 7.7.4
    • Editor - Core
    • None

    Description

      Problem

      Copy and pasted JSON isn't formatted correctly when inserted into the Code Block Macro. The JSON loses it's formatting and doesn't retain the correct structure once pasted into the block. 

      Environment

      Confluence 7.7.3 > 

      Steps to Reproduce

      • Add a code block macro to a page
      • Copy and paste a block of formatted JSON into the macro:
      • {
            "glossary": {
                "title": "example glossary",
        		"GlossDiv": {
                    "title": "S",
        			"GlossList": {
                        "GlossEntry": {
                            "ID": "SGML",
        					"SortAs": "SGML",
        					"GlossTerm": "Standard Generalized Markup Language",
        					"Acronym": "SGML",
        					"Abbrev": "ISO 8879:1986",
        					"GlossDef": {
                                "para": "A meta-markup language, used to create markup languages such as DocBook.",
        						"GlossSeeAlso": ["GML", "XML"]
                            },
        					"GlossSee": "markup"
                        }
                    }
                }
            }
        } 

      Expected Results

      We expect that the JSON will retain it's formatting, as in the example box above. 

      Actual Results

      Instead the code block strips the white. space from the JSON strips all white space resulting in the something like the following:

      {
      "glossary": {
      "title": "example glossary",
      "GlossDiv": {
      "title": "S",
      "GlossList": {
      "GlossEntry": {
      "ID": "SGML",
      "SortAs": "SGML",
      "GlossTerm": "Standard Generalized Markup Language",
      "Acronym": "SGML",
      "Abbrev": "ISO 8879:1986",
      "GlossDef": {
      "para": "A meta-markup language, used to create markup languages such as DocBook.",
      "GlossSeeAlso": ["GML", "XML"]
      },
      "GlossSee": "markup"
      }
      }
      }
      }
      } 

      Workaround

      (Add a workaround, if available)

      Notes

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              danthony@atlassian.com Dante Anthony
              Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: