开发者

JSON to Javascript object literal notation?

开发者 https://www.devze.com 2023-04-09 09:45 出处:网络
The methods of the dynamic Google Graph API want Javascript object literals as their argument, but I only have the data as JSON. What do I do? Is there any way that I could convert my JSON to an objec

The methods of the dynamic Google Graph API want Javascript object literals as their argument, but I only have the data as JSON. What do I do? Is there any way that I could convert my JSON to an object literal?

The format they want is here: http://code.google.com/intl/sv-SE/apis/chart/interactive/docs/reference.html#DataTable

I PHP, and also jQuery front end. I would appreciate front end or back end solutions. In the back end, I actually have the data in associative arrays so I can do anything with it th开发者_Go百科ere.


JSON is designed as a subset of Javascript object literal notation. Any* valid JSON code is already valid to interpret as a JavaScript literal.

* Technically, a few rare whitespace characters are treated differently, but this is relevant to almost nobody.

0

精彩评论

暂无评论...
验证码 换一张
取 消