Hacker News new | past | comments | ask | show | jobs | submit login

The point of JSON is that it is a subset of JavaScript and you could pass it to `eval`.



I don't see why to stick to being a JavaScript subset. Yes, in the olden days it was practical with JSON that there is no need to write a dedicated parser, just pass the data to eval(). Nowadays you should not pass anything to eval, apart from metaprogramming purposes (in which case the input is fully in control of the code).


Yes, it is mighty convenient even if JSON is generated by something else to just add a let X = in front and call it js.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: