添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I want to convert array to json object in js or jquery. Is there any function is available or lib

Thanks in advance

In modern browsers you can simply use JSON.stringify(someJSObject) to convert any JavaScript object (that includes arrays) to a JSON string.

To ensure it also works in less modern browsers, include https://github.com/douglascrockford/JSON-js/blob/master/json2.js on your page.

yes, your browser can't be 3 years old... If it is, it's not that difficult to create custom object->json parser ladar Jan 12, 2012 at 12:35 IE6 has about 1% share, so I don't really have to care about it. And I thought that IE8 has JSON support (with maybe some issues with callbacks). ladar Jan 12, 2012 at 13:08 I said IE 8 supports it. IE 7 doesn't. Between IE 7 and IE 8 you are talking about more than one in twenty users. (Usual provisos about browser stats apply). Quentin Jan 12, 2012 at 13:13 "Hit" not "Pass". The point in support an old browser is that more than 1 in 20 people use it. That's a lot of customers / advert views / whatever. Quentin Jan 12, 2012 at 13:31