Javascript JSON Parse JSON和Jquery ParseJson在visualforce中不起作用

Javascript JSON Parse JSON和Jquery ParseJson在visualforce中不起作用,javascript,jquery,json,visualforce,Javascript,Jquery,Json,Visualforce,我试图在salesforce visual force中解析json字符串,它在标准HTML jquery测试页面中运行良好,但在我的visual force页面中不起作用。我检查了,json字符串是有效的。有人能帮忙吗 MyController.MyCompany( j$('#input').val(),function(result,event){ alert(result);// this alert shows the JSON string from co

我试图在salesforce visual force中解析json字符串,它在标准HTML jquery测试页面中运行良好,但在我的visual force页面中不起作用。我检查了,json字符串是有效的。有人能帮忙吗

MyController.MyCompany( j$('#input').val(),function(result,event){

              alert(result);// this alert shows the JSON string from controller
              var parsedRes=jQuery.parseJSON(result);
              var parsedRes2=JSON.parse(result);
              alert(parsedRes); //this is not alerting
              alert(parsedRes2); this is not alerting
我在其他JSON验证网站上也做了同样的尝试,除了VisualForce之外,一切都很好

JSON是:

{"CompanyResponse":{"@ServiceVersionNumber":"2.0","TransactionDetail":{"ApplicationTransactionID":"Id-fc6a4756f6b52b00f2ae0e009fcc2af3-1","ServiceTransactionID":"Id-fc6a4756f6b52b00f2ae0e009fcc2af3-1","TransactionTimestamp":"2015-11-14T17:10:20"},"TransactionResult":{"SeverityText":"Information","ResultID":"CM000","ResultText":"Success"},"FindCompanyResponseDetail":{"CandidateMatchedQuantity":1,"CandidateReturnedQuantity":1,"FindCandidate":[{"DUNSNumber":"884745530","OrganizationPrimaryName":{"OrganizationName":{"$":"AMAZON.COM, INC."}},"TradeStyleName":[{"OrganizationName":{"$":"Amazon.Com"}}],"MarketabilityIndicator":true,"PrimaryAddress":{"StreetAddressLine":[{"LineText":"410 Terry Ave N"}],"PrimaryTownName":"Seattle","CountryISOAlpha2Code":"US","PostalCode":"98109","PostalCodeExtensionCode":"5210","TerritoryOfficialName":"Washington","TerritoryAbbreviatedName":"WA","MetropolitanStatisticalAreaUSCensusCode":["42660"]},"TelephoneNumber":{"TelecommunicationNumber":"2062661000"},"FacsimileNumber":{"TelecommunicationNumber":"2062664952"},"FamilyTreeMemberRole":[{"FamilyTreeMemberRoleText":{"@CodeValue":12771,"$":"Headquarters"}}],"StandaloneOrganizationIndicator":false,"IndustryCode":[{"@TypeText":"D&B Standard Industry Code","@CodeValue":3599,"IndustryCode":{"$":"59610000"},"IndustryCodeDescription":[{"@IndustryCodeDescriptionLengthCode":2121,"$":"CATALOG,MAIL HOUSES"}]}],"ConsolidatedEmployeeDetails":{"TotalEmployeeQuantity":154100},"PubliclyTradedCompanyIndicator":true,"UpwardFamilyMemberPubliclyTradedCompanyIndicator":true,"StockExchangeDetails":[{"StockExchangeTickerName":"AMZN"},{"StockExchangeTickerName":"AMZ"},{"StockExchangeName":{"@CodeValue":23343,"$":"Dusseldorf Stock Exchange"},"StockExchangeTickerName":"AMZ"},{"StockExchangeName":{"@CodeValue":23344,"$":"Frankfurt Stock Exchange"},"StockExchangeTickerName":"AMZ"},{"StockExchangeName":{"@CodeValue":23345,"$":"Hamburg Stock Exchange"},"StockExchangeTickerName":"AMZ"},{"StockExchangeName":{"@CodeValue":23357,"$":"BMV"},"StockExchangeTickerName":"AMZN"},{"StockExchangeName":{"@CodeValue":23360,"$":"Borse Munchen"},"StockExchangeTickerName":"AMZ"},{"StockExchangeName":{"@CodeValue":23367,"$":"SSE"},"StockExchangeTickerName":"AMZN"},{"StockExchangeName":{"@CodeValue":23378,"$":"SIX Swiss Exchange"},"StockExchangeTickerName":"US1760"},{"StockExchangeName":{"@CodeValue":23378,"$":"SIX Swiss Exchange"},"StockExchangeTickerName":"US1759"},{"StockExchangeName":{"@CodeValue":23378,"$":"SIX Swiss Exchange"},"StockExchangeTickerName":"US1758"},{"StockExchangeName":{"@CodeValue":23398,"$":"BVL"},"StockExchangeTickerName":"AMZN"},{"StockExchangeTickerName":"AMA-U"},{"StockExchangeTickerName":"AMZNn"},{"StockExchangeTickerName":"AMZN"},{"StockExchangeTickerName":"AMZN"},{"StockExchangeTickerName":"AMZN"},{"StockExchangeTickerName":"AMZN"},{"StockExchangeTickerName":"AMZO34"},{"StockExchangeTickerName":"AMZF"},{"StockExchangeTickerName":"AMZN"},{"StockExchangeName":{"@CodeValue":23338,"$":"BVC (Colombia)"},"StockExchangeTickerName":"AMZN"}],"SalesRevenueAmount":{"@CurrencyISOAlpha3Code":"USD","@UnitOfSize":"Million","$":88988},"DisplaySequence":1}]}}}

数据已经是json格式。您不需要再次解析它

您可以控制台.log('parsedRes',parsedRes')吗?控制台中没有任何内容。由于某种原因,json字符串似乎未被解析。请使用getJson方法而不是MyController.MyCompany