Is JSON expression just LISP in JSON format? #674
-
I just read the spec of JSON expressions https://jsonjoy.com/specs/json-expression and to me that looks exactly like any other LISP with a slightly twist on the syntax. So I thought, better ask. How is this different to LISP? Did you had LISP in mind when you designed this? I am just curious, not gonna suggest any change or anything. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yes, it has the LISP-like syntax! I was actually also thinking to create LISP-like bracket grammar for is. So instead of JSON: [".", "a", "b"] // 'ab' One could also write/read LISP-like debugging format:
What I had in mind is to make it portable, compact, and fast.
Regarding the syntax. JSON Expression is an S-expression which uses valid JSON syntax to define the expressions. It also uses JSON as its only data type, and also uses JSON as its only valid literals. Any JSON Expression is a valid JSON value. For example, The only exception from JSON is that arrays are treated as operators. So to represent a JSON array value, one has to use a nullary operator for it, i.e. wrap it in extra |
Beta Was this translation helpful? Give feedback.
Yes, it has the LISP-like syntax! I was actually also thinking to create LISP-like bracket grammar for is. So instead of JSON:
One could also write/read LISP-like debugging format:
What I had in mind is to make it portable, compact, and fast.
json-joy
complies JSON Expression to native JavaScript. For example,['+', 1, 2]
complies directly to() => 3
. If there is an external input in the expression, say['+', 1, ['$', '/data']]
, it still complies to something fast like() => 1 …