Is it valid to define functions in JSON results?

后端 未结 11 865
一向
一向 2020-11-22 11:38

Part of a website\'s JSON response had this (... added for context):

{..., now:function(){return(new Date).getTime()}, ...}

Is adding anony

11条回答
  •  攒了一身酷
    2020-11-22 12:03

    JSON explicitly excludes functions because it isn't meant to be a JavaScript-only data structure (despite the JS in the name).

提交回复
热议问题