简体   繁体   中英

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 there.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM