Part of a website’s JSON response had this (… added for context):
{..., now:function(){return(new Date).getTime()}, ...}
Is adding anonymous functions to JSON valid? I would expect each time you access ‘time’ to return a different value.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No.
JSON is purely meant to be a data description language. As noted on http://www.json.org, it is a “lightweight data-interchange format.” – not a programming language.
Per http://en.wikipedia.org/wiki/JSON, the “basic types” supported are:
point)
with backslash escaping)
(true and false)
sequence of values, comma-separated
and enclosed in square brackets)
pairs, comma-separated and enclosed
in curly braces)
null