JSONTY is a minimalist programming language based on JSON. It allows you to manipulate variables, perform operations, execute conditions, loops, and define functions. Created by MrJulus
fs, readline-sync
You can also use the NPM Package : npm install jsonty
[✅] Add functions with multiple return values
[✅] Add logical operators (>, <, =, !=, <=, >=)
[✅] Allow dynamic inputs (ask can be enhanced to support numbers).
[✅] Convert variables
[✅] Add a switch structure
[❌] Add ternary operator (? :)
[❌] Add break and continue in loops
[❌] Add arrays and objects (set could allow more complex structures).
[❌] Add logical operators && and || for if and while.
[❌] Import from other files
{
"set": {
"x": "10",
"y": "20"
}
}
{
"show": ["(x)"]
}
{
"set": {
"z": "(x) (+) (y)"
}
}
Different mathematical operations: +, -, *, /, =, !=, <=, and >=
{
"if": {
"condition": "(x) (>) 5",
"do": {
"show": ["x is greater than 5"]
}
},
"else if": {
"condition": "(x) (<) 5",
"do": {
"show": ["x is less than 5"]
}
},
"else": {
"do": {
"show": ["x is equal to 5"]
}
}
}
{
"for": {
"i": [1, 5],
"do": {
"show": ["(i)"]
}
}
}
{
"while": {
"condition": "(x) (<) 20",
"do": {
"set": {
"x": "(x) (+) 1"
},
"show": ["(x)"]
}
}
}
{
"fct": {
"name": "calcul",
"args": ["a", "b"],
"do": {
"set": {
"result": "(a) (+) (b)"
},
"return": "(result)"
}
}
}
{
"fct": {
"name": "calcul",
"args": ["a", "b"],
"do": {
"set": {
"addition": "(a) (+) (b)",
"moins": "(a) (-) (b)"
},
"return": ["(result)", "(moins)"]
}
}
}
{
"call": {
"name": "calcul",
"args": ["10", "5"]
},
"show": ["(result)"]
}
{
"call": {
"name": "calcul",
"args": ["10", "5"]
},
"show": ["(result[0]), (result[1])"]
}
{
"switch": {
"value": "(a)",
"1": {
"do": {
"show": ["a is 1"]
}
},
"2": {
"do": {
"show": ["a is 2"]
}
},
"default": {
"do": {
"show": ["a is neither 1 nor 2"]
}
}
}
}
{
"ask": {
"q": "Enter your name"
},
"show": ["Hello, (q)!"]
}
{
"try": {
"do": {
"set": {
"x": "1 (/) 0"
}
}
},
"catch": {
"do": {
"show": ["Error detected: (error)"]
}
}
}
Mr_Julus (@MrJulus)