开发者

JSON to Javascript object literal notation?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜