I agree that putting scripts in a JSON structure is definitely not in the JSON standard. Even though JSON, before being a data-exchange standard, was just the run-of-the-mill javascript object notation in which script coderefs are perfectly acceptable.
The thing is that most ajax based frameworks, such as ExtJS, accept, or even recommend putting scripts in a JSON structure. So I guess I'll keep looking for a module that can dump that... or write my own.
cheers,
-- miguel | [reply] |
A JSON file that includes arbitrary JavaScript code is not a JSON file, it's a JavaScript file. You should be looking for tools to help you generate JavaScript, not JSON.
| [reply] |
I think it's really easy to confuse/conflate Javascript object literal notation with JSON - they're not the same thing.
Update: hmmm ... well that was vague. JSON is a subset of Javascript object literal notation that's used for *DATA* exchange. That's why if want to pass around function definitions in JSON, you'll need to de-stringify them - basically subverting the concept of JSON being just for *DATA* exchange.
| [reply] |