我正在Visual Studio 2019,Visual Studio Code和UltraEdit中进行测试。
以下有效的JSON自动格式:
[
{
"Name": "3M Company",
"Sector": "Industrials",
"Symbol": "MMM"
},
{
"Name": "A.O. Smith Corp",
"Sector": "Industrials",
"Symbol": "AOS"
},
但是以下有效的JSON根本不格式化,它仅显示为一行:
{"Name":"SP500","Positions":{"MMM":{"Ticker":"MMM","Size":100,"InitiationDate":"2019-04-18T00:00:00","InitiationPrice":218.88,"PreviousCloseDate":"2019-04-18T16:02:42.239","PreviousClosePrice":218.88,"CurrentCloseDate":"2019-04-18T16:02:42.239","CurrentClosePrice":218.88,"LastDate":"2019-04-18T00:00:00","LastPrice":218.88,"DailyProfitLoss":0.00,"TotalProfitLoss":0.00},"AOS":{"Ticker":"AOS","Size":100,"InitiationDate":"2019-04-18T00:00:00","InitiationPrice":56.49,"PreviousCloseDate":"2019-04-18T16:00:54.409","PreviousClosePrice":56.49,"CurrentCloseDate":"2019-04-18T16:00:54.409","CurrentClosePrice":56.49,"LastDate":"2019-04-18T00:00:00","LastPrice":56.49,"DailyProfitLoss":0.00,"TotalProfitLoss":0.00}}}
但是https://jsonlint.com/对其进行格式化:
{
"Name": "SP500",
"Positions": {
"MMM": {
"Ticker": "MMM",
"Size": 100,
"InitiationDate": "2019-04-18T00:00:00",
"InitiationPrice": 218.88,
"PreviousCloseDate": "2019-04-18T16:02:42.239",
"PreviousClosePrice": 218.88,
"CurrentCloseDate": "2019-04-18T16:02:42.239",
"CurrentClosePrice": 218.88,
"LastDate": "2019-04-18T00:00:00",
"LastPrice": 218.88,
"DailyProfitLoss": 0.00,
"TotalProfitLoss": 0.00
},
"AOS": {
"Ticker": "AOS",
"Size": 100,
"InitiationDate": "2019-04-18T00:00:00",
"InitiationPrice": 56.49,
"PreviousCloseDate": "2019-04-18T16:00:54.409",
"PreviousClosePrice": 56.49,
"CurrentCloseDate": "2019-04-18T16:00:54.409",
"CurrentClosePrice": 56.49,
"LastDate": "2019-04-18T00:00:00",
"LastPrice": 56.49,
"DailyProfitLoss": 0.00,
"TotalProfitLoss": 0.00
},
这是否仅是由于一个应用程序相对于另一个应用程序内置的智能程度?
哪些因素控制JSON的格式显示?