In ECMAScript (as well as its implementations JavaScript or ActionScript), an object with methods can be written using the object literal like this:
These object literals are similar to anonymous classes in other languages like Java.
The JSON data interchange format is based on a subset of the JavaScript object literal syntax, with some additional restrictions (among them requiring all keys to be quoted, and disallowing functions and everything else except data literals). Because of this, almost every valid JSON document (except for some subtleties with escaping) is also valid JavaScript code, a fact exploited in the JSONP technique.
Donovan, John (1972). Systems programming. McGraw-Hill. p. 45. ISBN 978-0-07-017603-4. OCLC 298763. 978-0-07-017603-4 ↩
"Literals". IBM Knowledge Center. 18 June 2009. Retrieved 13 May 2020. https://www.ibm.com/support/knowledgecenter/SSQ2R2_14.2.0/com.ibm.ent.asm.zos.doc/asmr102056.htm ↩