TablePlus-Windows icon indicating copy to clipboard operation
TablePlus-Windows copied to clipboard

Broken formatting with Copy As > JSON

Open caseydwyer opened this issue 1 year ago • 0 comments

Overview

When copying a row as JSON, the copied value doesn't account for nested objects within JSON-type columns. It would be great if this came out as proper, valid, and formatted JSON—see example below. Could also probably drop the array wrap (ie, outer [...]) if only one row is selected/copied.

The steps to reproduce this issue:

  • Open a table with a json-type column and some data in that column
  • Right-click a single row
  • Select Copy As > JSON from the flyout menu
  • Paste that text into a code editor, to confirm broken double-quotes

Environment

  1. Driver: MySQL v8.0.36
  2. TablePlus Build: Build 276

Current Copy As > JSON Structure

[
  {
    "id": 2,
    "title": "Recurring Payment Failed",
    "description": "Default email template, sent to a donor if their Recurring Payment fails to process.",
    "context": "recurring_payment.failed",
    "recipient": "submission.email_address",
    "config": "{\\"copies\\": {\\"cc\\": null, \\"bcc\\": null}, \\"subject\\": \\"Recurring Donation Failed\\", \\"reply_to\\": null, \\"always_send\\": false, \\"footer_type\\": \\"default\\", \\"header_type\\": \\"default\\", \\"header_image\\": null}",
    "content": "{\\"body\\": [{\\"type\\": \\"heading\\", \\"attrs\\": {\\"level\\": 2, \\"textAlign\\": \\"left\\"}, \\"content\\": [{\\"text\\": \\"Heads up!\\", \\"type\\": \\"text\\"}]}, {\\"type\\": \\"paragraph\\", \\"attrs\\": {\\"textAlign\\": \\"left\\"}, \\"content\\": [{\\"text\\": \\"We ran into an issue with your recurring gift; it looks like the payment method we have on file is no longer valid. This is typically because of an expired card or deactivated payment method.\\", \\"type\\": \\"text\\"}]}, {\\"type\\": \\"paragraph\\", \\"attrs\\": {\\"textAlign\\": \\"left\\"}, \\"content\\": [{\\"text\\": \\"At your earliest convenience, \\", \\"type\\": \\"text\\"}, {\\"text\\": \\"please click the button below to update your payment method.\\", \\"type\\": \\"text\\", \\"marks\\": [{\\"type\\": \\"bold\\"}]}]}, {\\"type\\": \\"set\\", \\"attrs\\": {\\"id\\": \\"m0pjmdml\\", \\"values\\": {\\"type\\": \\"payment_summary\\"}}}], \\"footer\\": \\"\\", \\"header\\": \\"\\"}",
    "created_at": "2024-09-05 17:10:28",
    "updated_at": "2024-09-05 18:44:42"
  }
]

Expected Copy As > JSON Structure

{
    "id": 2,
    "title": "Recurring Payment Failed",
    "description": "Default email template, sent to a donor if their Recurring Payment fails to process.",
    "context": "recurring_payment.failed",
    "recipient": "submission.email_address",
    "config":
    {
        "copies":
        {
            "cc": null,
            "bcc": null
        },
        "subject": "Recurring Donation Failed",
        "reply_to": null,
        "always_send": false,
        "footer_type": "default",
        "header_type": "default",
        "header_image": null
    },
    "content":
    {
        "body":
        [
            {
                "type": "heading",
                "attrs":
                {
                    "level": 2,
                    "textAlign": "left"
                },
                "content":
                [
                    {
                        "text": "Heads up!",
                        "type": "text"
                    }
                ]
            },
            {
                "type": "paragraph",
                "attrs":
                {
                    "textAlign": "left"
                },
                "content":
                [
                    {
                        "text": "We ran into an issue with your recurring gift; it looks like the payment method we have on file is no longer valid. This is typically because of an expired card or deactivated payment method.",
                        "type": "text"
                    }
                ]
            },
            {
                "type": "paragraph",
                "attrs":
                {
                    "textAlign": "left"
                },
                "content":
                [
                    {
                        "text": "At your earliest convenience, ",
                        "type": "text"
                    },
                    {
                        "text": "please click the button below to update your payment method.",
                        "type": "text",
                        "marks":
                        [
                            {
                                "type": "bold"
                            }
                        ]
                    }
                ]
            },
            {
                "type": "set",
                "attrs":
                {
                    "id": "m0pjmdml",
                    "values":
                    {
                        "type": "payment_summary"
                    }
                }
            }
        ],
        "footer": "",
        "header": ""
    },
    "created_at": "2024-09-05 17:10:28",
    "updated_at": "2024-09-05 18:44:42"
}

caseydwyer avatar Sep 06 '24 14:09 caseydwyer