Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format JavaScript objects with unquoted property names #184

Open
salcode opened this issue Feb 7, 2020 · 0 comments
Open

Format JavaScript objects with unquoted property names #184

salcode opened this issue Feb 7, 2020 · 0 comments

Comments

@salcode
Copy link
Owner

salcode commented Feb 7, 2020

In #181 we added a new command :JSONFormat which takes a JSON object and properly formats it.

e.g.

{"data":{"attributes":{"name":"sal"}}}

becomes

{
    "data": {
        "attributes": {
            "name": "sal"
        }
    }
}

Unquoted Properties

Unfortunately, I find I'm often dealing with objects in JavaScript, which have less strict formatting rules. Specifically, the property names do not need to be quoted. e.g.

{
    data: {
        attributes: {
            name: "sal"
        }
    }
}

Note: data, attributes, and name do not have quotes around them.

Additionally unfortunately, our current method fails in this situation.

It would be nice if the formatting logic handled this scenario as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant