7 ms·
You can try prettier online at https://prettier.github.io/prettier/ https://prettier.github.io/prettier/ Not sure exactly what you mean, but here's an example
by rattray 10y ago
You can try prettier online at https://prettier.github.io/prettier/ https://prettier.github.io/prettier/
Not sure exactly what you mean, but here's an example with JSON: https://prettier.github.io/prettier/#%7B%22content%22%3A%22x%20%3D%20%7B%5C%22name%5C%22%3A%5C%22Luke%20Skywalker%5C%22%2C%5C%22height%5C%22%3A%5C%221.72%20m%5C%22%2C%5C%22mass%5C%22%3A%5C%2277%20Kg%5C%22%2C%5C%22hair_color%5C%22%3A%5C%22Blond%5C%22%2C%5C%22skin_color%5C%22%3A%5C%22Caucasian%5C%22%2C%5C%22eye_color%5C%22%3A%5C%22Blue%5C%22%2C%5C%22birth_year%5C%22%3A%5C%2219%20BBY%5C%22%2C%5C%22gender%5C%22%3A%5C%22Male%5C%22%2C%5C%22homeworld%5C%22%3A%5C%22http%3A%2F%2Fswapi.co%2Fapi%2Fplanets%2F1%2F%5C%22%2C%5C%22films%5C%22%3A%20%5B%5C%22http%3A%2F%2Fswapi.co%2Fapi%2Ffilms%2F1%2F%5C%22%2C%5C%22http%3A%2F%2Fswapi.co%2Fapi%2Ffilms%2F2%2F%5C%22%2C%5C%22http%3A%2F%2Fswapi.co%2Fapi%2Ffilms%2F3%2F%5C%22%5D%2C%5C%22species%5C%22%3A%20%5B%5C%22http%3A%2F%2Fswapi.co%2Fapi%2Fspecies%2F1%2F%5C%22%5D%2C%5C%22vehicles%5C%22%3A%20%5B%5C%22http%3A%2F%2Fswapi.co%2Fapi%2Fvehicles%2F14%2F%5C%22%2C%5C%22http%3A%2F%2Fswapi.co%2Fapi%2Fvehicles%2F30%2F%5C%22%5D%2C%5C%22starships%5C%22%3A%20%5B%5C%22http%3A%2F%2Fswapi.co%2Fapi%2Fstarships%2F12%2F%5C%22%2C%5C%22http%3A%2F%2Fswapi.co%2Fapi%2Fstarships%2F22%2F%5C%22%5D%2C%5C%22created%5C%22%3A%5C%222014-12-09T13%3A50%3A51.644000Z%5C%22%2C%5C%22edited%5C%22%3A%5C%222014-12-10T13%3A52%3A43.172000Z%5C%22%2C%5C%22url%5C%22%3A%5C%22http%3A%2F%2Fswapi.co%2Fapi%2Fpeople%2F1%2F%5C%22%7D%22%2C%22options%22%3A%7B%22printWidth%22%3A80%2C%22tabWidth%22%3A2%2C%22singleQuote%22%3Afalse%2C%22trailingComma%22%3A%22none%22%2C%22bracketSpacing%22%3Atrue%2C%22jsxBracketSameLine%22%3Afalse%2C%22parser%22%3A%22babylon%22%2C%22semi%22%3Atrue%2C%22useTabs%22%3Afalse%2C%22doc%22%3Afalse%7D%7D https://prettier.github.io/prettier/#%7B%22content%22%3A%22x...
Prettier doesn't support JSON files per se (and doesn't currently plan to [0]), so you need to provide a leading `x = {...` or similar to ensure the { is parsed as an object instead of a block.
[0] https://github.com/prettier/prettier/issues/322 https://github.com/prettier/prettier/issues/322
- WhitneyLand 10y agoLooks like it has no understanding of json at all. If you have a constant like this, except really long and ugly, there's quite a bit that can be done to make the code more readable. Maybe I'll add an issue and see if anyone else cares about it. var simpleJson = '{ "DevelopersNeedUXToo": [ { "Color": "Red", "Name": "Lee" } ] }'