Easily paste JSON

Issue #1597 resolved
Luke Buthman created an issue

If possible, I want to be able to paste JSON inside a pair of single quotes and have string concatenation and escaping other single quotes happen automatically. For example, I want to paste this:

{
    "d": {
        "__metadata": {
            "id": "https://url:443/path('')",
            "uri": "https://url:443/path('')",
            "type": "type"
        },
        "DocNumber": "1",
        "Site": "2",
        "StorageLoc": "3",
        "PostBlock": "",
        "MessageType": "",
        "Message": "",
    }
}

And get something like this:

'{"d": { ' +
    '"__metadata": {' +
    '"id": "https://url:443/path(\'\')",' +
    '"uri": "https://url:443/path(\'\')",' +
    '"type": "type"' +
    '},' +
    '"DocNumber": "1",' +
    '"Site": "2",' +
    '"StorageLoc": "3",' +
    '"PostBlock": "",' +
    '"MessageType": "",' +
    '"Message": "",' +
    '}}'

Comments (7)

  1. Scott Wells repo owner

    Thanks for logging. I think this could be generalized to any pasting anything into a string literal that's multi-line and/or contains single quotes that need to be escaped. I'll take a look at how this might be handled.

  2. Luke Buthman reporter

    Wow, that’s really cool, I love to see when things comes to life like this. Thanks so much for your work!

  3. Log in to comment