fork download
  1. json = '''{
  2. "type": "Request",
  3. "kind": "TeamsWebhook",
  4. "inputs": {
  5. "triggerAuthenticationType": "All",
  6. "schema": {
  7. "type": "object",
  8. "properties": {
  9. "type": {
  10. "type": "string"
  11. },
  12. "attachments": {
  13. "type": "array",
  14. "items": {
  15. "type": "object",
  16. "properties": {
  17. "contentType": {
  18. "contentType": {
  19. "type": "string"
  20. }
  21. },
  22. "content": {
  23. "content": {
  24. "type": "object",
  25. "properties": {
  26. "$schema": {
  27. "type": "string"
  28. },
  29. "type": {
  30. "type": "string"
  31. },
  32. "version": {
  33. "type": "string"
  34. },
  35. "body": {
  36. "type": "array",
  37. "items": {
  38. "type": "object",
  39. "properties": {
  40. "type": {
  41. "type": "string"
  42. }
  43. },
  44. "required": [
  45. "type"
  46. ]
  47. }
  48. }
  49. }
  50. }
  51. }
  52. },
  53. "required": [
  54. "contentType",
  55. "content"
  56. ]
  57. }
  58. }
  59. }
  60. }
  61. },
  62. "metadata": {}
  63. }'''
  64.  
  65. import re
  66. better_json = re.sub(r'^((\s*)".*?":)\s*([\[{])', r'\1\n\2\3', json, flags=re.MULTILINE)
  67. print(better_json)
Success #stdin #stdout 0.05s 9764KB
stdin
Standard input is empty
stdout
{
  "type": "Request",
  "kind": "TeamsWebhook",
  "inputs":
  {
    "triggerAuthenticationType": "All",
    "schema":
    {
      "type": "object",
      "properties":
      {
        "type":
        {
          "type": "string"
        },
        "attachments":
        {
          "type": "array",
          "items":
          {
            "type": "object",
            "properties":
            {
              "contentType":
              {
                "contentType":
                {
                  "type": "string"
                }
              },
              "content":
              {
                "content":
                {
                  "type": "object",
                  "properties":
                  {
                    "$schema":
                    {
                      "type": "string"
                    },
                    "type":
                    {
                      "type": "string"
                    },
                    "version":
                    {
                      "type": "string"
                    },
                    "body":
                    {
                      "type": "array",
                      "items":
                      {
                        "type": "object",
                        "properties":
                        {
                          "type":
                          {
                            "type": "string"
                          }
                        },
                        "required":
                        [
                          "type"
                        ]
                      }
                    }
                  }
                }
              }
            },
            "required":
            [
              "contentType",
              "content"
            ]
          }
        }
      }
    }
  },
  "metadata":
  {}
}