Reformat JSON in JS file
I'm trying to get the Reformat Code feature to work with JSON in a JS file but not having much luck. I played around with the Code Style settings, but there only seems to be options for formatting arrays unless I missed something.
Given one line of JavaScript/JSON:
var news = {"mynews":{"create_date":"2011-05-10T00:00:00Z","expiration_date":"2050-12-31T00:00:00Z","article":{"aid_1":{"article_id":"1","update_time":"2011-05-10T13:30:00Z","headline":"Headline goes here","image_data":"","full_article":""},"aid_2":{"article_id":"2","update_time":"2011-05-10T12:33:46Z","headline":"Headline goes here","image_data":"","full_article":""}},"category":[{"title":"Top Stories","cat_article":["1","2","3","4","5"]}]}};
I'd like to see something more readable like when typed in and the code was autoindented like below:
var news = {
"mynews":{
"create_date":"2011-05-10T00:00:00Z",
"expiration_date":"2050-12-31T00:00:00Z",
"article":{
"aid_1":{
"article_id":"1",
"update_time":"2011-05-10T13:30:00Z",
"headline":"Headline goes here",
"image_data":"",
"full_article":""},
"aid_2":{
"article_id":"2",
"update_time":"2011-05-10T12:33:46Z",
"headline":"Headline goes here",
"image_data":"",
"full_article":""}},
"category":[
{
"title":"Top Stories",
"cat_article":["1","2","3","4","5"]
}
]
}
};
Instead when I use "Reformat Code", it looks like the following:
var news = {"mynews":{"create_date":"2011-05-10T00:00:00Z","expiration_date":"2050-12-31T00:00:00Z","article":{"aid_1":{"article_id":"1","update_time":"2011-05-10T13:30:00Z","headline":"Headline goes here","image_data":"","full_article":""},"aid_2":{"article_id":"2","update_time":"2011-05-10T12:33:46Z","headline":"Headline goes here","image_data":"","full_article":""}},"category":
[
{"title":"Top Stories","cat_article":[
"1","2","3","4","5"
]}
]}};
Please sign in to leave a comment.
Please submit a bug at http://youtrack.jetbrains.net and attach your sample. Thank you!