Syntax · 1 of 6

Types & literals

OxiScript values map directly to JSON. There are six types: number, string, bool, null, array, and object.

Numbers

let a = 42
let b = 3.14
let c = -7
let d = 0
let e = 1000000

All numbers are 64-bit floats internally. There is no separate integer type — but they round-trip JSON cleanly when whole.

Strings

Both single and double quotes work. Use whichever doesn't conflict with the contents.

let a = "hello"
let b = 'world'
let c = "with \"escaped\" quotes"
let d = 'newline\nhere'
let e = ""             // empty string

Booleans

let yes = true
let no  = false

Null

let nothing = null
if user == null { abort "missing" }

find_one returns null when the query has no match. Always check for it.

Arrays

let empty = []
let nums  = [1, 2, 3]
let mixed = [1, "two", true, null]
let nested = [[1, 2], [3, 4]]
let docs  = [{name: "a"}, {name: "b"}]

Indexing

let xs = [10, 20, 30]
let first = xs[0]
let second = xs[1]

Objects

let empty = {}
let user = {name: "Alice", age: 30}
let with_quotes = {"first name": "Alice"}
let nested = {
    user: {name: "Alice", address: {city: "Tokyo"}},
    tags: ["vip", "early"]
}

Field access

let n = user.name
let c = nested.user.address.city
let by_index = nested["user"]

Mongo-style $ operators

OxiScript treats $set, $inc, $push, $gte, etc. as first-class identifiers — no quoting needed when used as keys.

update("users", {age: {$gte: 18}}, {
    $set: {is_adult: true},
    $inc: {seen: 1},
    $push: {tags: "verified"}
})

Type quick-reference

OxiScriptJSONNotes
42, 3.14numberf64 internally
"x", 'x'string\", \', \n, \t, \\ escapes
true, falsebool
nullnullcompare with ==
[1,2,3]arrayindexed with arr[i]
{a: 1}objectaccess with obj.a or obj["a"]
Report Issue