Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Javascript in your JSON

by Anonymous Monk
on Apr 08, 2009 at 19:08 UTC ( [id://756422]=note: print w/replies, xml ) Need Help??


in reply to Re: Javascript in your JSON
in thread Javascript in your JSON

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

Replies are listed 'Best First'.
Re^3: Javascript in your JSON
by ikegami (Patriarch) on Apr 08, 2009 at 19:14 UTC
    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.
Re^3: Javascript in your JSON
by derby (Abbot) on Apr 08, 2009 at 19:30 UTC

    I think it's really easy to confuse/conflate Javascript object literal notation with JSON - they're not the same thing.

    -derby

    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://756422]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-19 16:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found