Expressions and operators
Expressions are the only means of computing values in JSON UI. An expression is a string wrapped in parentheses and is used in two places. One is the creation-time expression that uses $variables as material (ignored, requires, variable values, size and position), and the other is the runtime expression that uses #properties as material (the source_property_name of a view binding). This chapter covers the operators you can use, how to cut and erase strings, how types change between number and string, expressions that kill the client, and the run results of Cinnabar, which reconstructs the engine evaluator without the game.
The concept of expressions and basic examples
One expression has the form (left operator right). A string value is wrapped in quotes, binding names start with # and variable names with $. The result goes into the property that target_property_name points to. If that property is #visible, the control shows and hides.
Example 1. An image visible only when the value is 12. #value is a binding that comes from somewhere. The result of the expression (true/false) goes into #visible.
"badge": {
"type": "image", "texture": "textures/ui/star",
"bindings": [
{ "binding_type": "view",
"source_property_name": "(#value = 12)",
"target_property_name": "#visible" }
]
}
Example 2. Showing only when the title string contains boss (containment check, EXP-07). String subtraction erases every occurrence, so if the erased result differs from the original, boss is contained.
{ "binding_type": "global", "binding_name": "#title_text" },
{ "binding_type": "view",
"source_property_name": "(not ((#title_text - 'boss') = #title_text))",
"target_property_name": "#visible" }
Example 3. Prefix check (EXP-08). '%.Ns' * #s is the first N bytes of #s. Below is an expression that is true when the title starts with a1; (a1; is 3 bytes).
"(('%.3s' * #title_text) = 'a1;')"
Example 4. Size expressions (creation time). size and offset use a separate syntax with units such as 100% - 10px and 100%c + 4px. This differs from parenthesized expressions (+ - * / = < >). The result table is in "Size expression (size string) result table" below.
Operators as the standard documentation describes them
The "Using Operators" table of the Bedrock Wiki (bedrock-wiki 0930b39 json-ui-intro.md) lists operators as follows. The meaning of this table and the verification results are judged by the rules of the operator table below.
| Operation | Wiki example | Verdict of this chapter |
|---|---|---|
Add + | ("100% + 420px"), ($text + ' my'), ($index + 2), ('#' + $bdg_nm + '_name') | String concatenation is the default (EXP-01) |
Subtract - | ("100% - 69px"), ($text - ' my'), ($index - 13) | For strings, removes every occurrence (EXP-12) |
Multiply *, divide / | ($var * 9), (#value / 2) | Integer division (EXP-18) |
=, >, < | ($var = 12), (#value > 13), ($var < 4) | Works |
| Greater or equal, less or equal | (#value > 2 or #value = 2), (#value < 2 or #value = 2) | There are no dedicated operators, so build with or (EXP-03) |
and, or, not | ($is_school and $is_open), (not (#name = 'text')) | Same precedence (EXP-29) |
The JSON UI reference of MS Learn (ms-learn a9fd1c0) (JsonUiReference) lists only properties and types and does not explain the expression syntax. Its enum tables also have every value cell empty as undefined and have type typos such as listing grid_item_template as an integer and font_scale_factor as a boolean. For expressions and values, follow this wiki's rules (the exhaustive vanilla search).
String format specifiers (the '%.Ns' family) and byte width
Multiplying a string by a format specifier gives part of the string. The wiki original is as follows.
Excerpt: Intro to JSON UI - Format Specifiers · docs/json-ui/json-ui-intro.md · Bedrock Wiki · License CC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository) · Commit 0930b39Format Specifiers
Assuming the variable $var is defined as:
"$var": "abcdefghijklmn"The following format specifiers can be used:
%.ns
Truncates the string to the first n byte.
Example:('%.7s' * $var)returnsabcdefg.
%0ns
Returns the full string if its length is n or more byte, otherwise returns0.
Example:
('%04s' * $var)returnsabcdefghijklmn
('%015s' * $var)returns0
%n.xs
Returns x byte from the start, padded with leading spaces to reach n byte in total.
Example:('%7.4s' * $var)returnsabcd.
%-n.xs
Returns x byte from the start, padded with trailing spaces to reach n byte in total.
Example:('%-7.4s' * $var)returnsabcd.
%ns
Adds spaces to the start to make the total length n byte, if needed.
Example:('%15s' * $var)returnsabcdefghijklmn.
%-ns
Adds spaces to the end to make the total length n byte, if needed.
Example:('%-15s' * $var)returnsabcdefghijklmn.Remember that the usage of this format is limited.
Note: the only working format is '%.Ns'. %0ns and the padding formats above do not work in game. On Windows 1.26.65.1, multiplying abcdef by %7.4s, %-7.4s, %9s, %-9s, %09s or %4.2s returned the input unchanged every time (no padding, no truncation, and not 0; measurement record, EXP-09, EXP-25). U+10000 and above (most emoji) is 4 bytes (EXP-24).
How to read this chapter
Read the rule lists below in the order operator table, handling strings, numbers and types, expressions that kill the client, variables and property names. For the caution about evidence, read the header before the operator table first.
An expression is a string wrapped in parentheses. It is used in the source_property_name of a view binding (using #property) and in variable values, ignored and requires (using $variable).
A caution about evidence. The 1,467 expressions of vanilla 1.26.50.4 use only not (993), or (230), + (200), and (130) and = (132). -, *, /, <, > and '%.Ns' never appear in vanilla. So the operator meanings in this chapter rest on bedrock-core's in-game measurements and the usage in distributed packs (BA, AP). Vanilla cannot judge "exists / does not exist". From 2026-10-21 the code of Cinnabar (CN), which reconstructs the native evaluator, and its run results (CN-run) are also used as evidence. Cinnabar is Rust code that reconstructs the JSON UI parser of the 26.30 native client, and its level is code. If it differs from game measurement, follow measurement.
Source notes. DF was measured on Windows 1.26.52 while building the research server, in a structure that draws several screens with one server form. NB was read from client binaries, and its level is code. EXP-47 and EXP-48 were read from the expression evaluator and item renderer of the Windows 1.26.63 client, and EXP-50~EXP-56 are rules read by decompiling the expression evaluator of the Android 1.26.52.3 and Windows 1.26.65.1 clients, measured on Windows 1.26.65.1. Those measurements were made in the measurement window juc_tester.json of the add-on addons/json-ui-claims (2026-11-20) and in a HUD title factory experiment (2026-11-19~20, measurement record), and in their examples #one is the integer 1.
Operator table
| Operation | Meaning | Verification |
|---|---|---|
a = b | Equality (string, number, boolean) | vanilla |
not a, a and b, a or b | Logic. Operators only in lowercase (EXP-51) | vanilla, measured |
a + b | String concatenation. A bound string + a number was also concatenated ('35' + 0 gives '350'). Do not trust it as numeric addition | vanilla, measured |
a - b (string) | Removes every occurrence of b from a | measured, working pack |
a - b (number) | Subtraction. ('35' - 0) is the number 35 | measured |
a * b | Multiplication. A boolean is 1/0. string * number is an empty string (EXP-31) | measured, working pack, code |
'%.Ns' * #s | The first N bytes of #s | working pack, code |
a / b | Division. Integer division for integers (EXP-18). string / string is the occurrence count (EXP-32). string / number freezes the Windows 1.26.65 client (EXP-49). Dividing by 0 leaves the left value with its type (EXP-55) | measured, code |
a > b, a < b | Ordering comparison. Also used with strings like $v > 'a'. When only one side is a string, truthiness is compared ('abc' > 0 is true, EXP-54) | measured, working pack |
>=, <= | Do not exist. Parsing fails, so the property stays at its default | measured, code |
% (remainder) | Does not exist. Invalid expression assert | measured |
!= | Does not exist. On Windows 1.26.65.1 it gave no value (Invalid expression in the log of the same window). Write (not (a = b)) | measured |
- [EXP-01] The operators you can use are
=,<,>,not,and,or,+,-,*,/and the string truncation'%.Ns' *. The precedence is as in the table below (CN reconstruction).{measured, working pack, vanilla, code (source)}(Source: BC-S14, BC-facts, BC 6.2-1, AP 4.7, VN, BW-intro, CN)
| Rank | Operators | Associativity |
|---|---|---|
| 1 (strongest) | Unary +, -, not | Attach only to the operand right after (EXP-37). A parenthesized group right after unary + makes the whole expression fail (EXP-53) |
| 2 | *, / | From the left |
| 3 | +, - | From the left |
| 4 | =, <, > | From the left. No chained comparison (EXP-28) |
| 5 | and, or | Same rank, from the left (EXP-29) |
- [EXP-02]
%is not an operator.((#c % 10) = 3)raises anInvalid expressionassert every time the screen opens. Do not use expressions like(x - x % 65536) / 65536from community examples (Chest-UI, etc.). On Windows 1.26.65.1((#v - 0) % 5)also gave no value (measurement record). Make remainders with EXP-38.{measured}(Source: BC-S14, BC-facts, MJ 4.2-7) - [EXP-03] There are no
>=and<=. A failed expression leaves the property at its default, so written to#visibleit looks always true. Write(a > b) or (a = b)(the generator ASJ uses this form too). In the CN evaluator<=is read as two operators and the whole expression becomes null.(not (#v < a))is also an alternative. On Windows 1.26.65.1((#v - 0) >= 10)gave no value and(not ((#v - 0) < 10))was true at 10 (measurement record).{measured, code (source)}(Source: BC-facts, BW-intro, CN-run, ASJ) - [EXP-04]
<and>work (CN evaluator, AP's use of>). The chained comparison962 < #c < 964is not a range check (EXP-28). On Windows 1.26.65.1<worked, and at 10(((#v - 0) > 5) and ((#v - 0) < 17))was true while the chained(5 < (#v - 0) < 7)was a wrong true.((5 < (#v - 0)) and ((#v - 0) < 7)), with literals on the left, gave no value (cause not isolated, measurement record). So write a range with the property on the left, as in((#c > 962) and (#c < 964)).{measured, working pack, code (source)}(Source: BC-S14, BC-facts, BC-S9, AP 4.7, CN-run) - [EXP-05] Even
'%.6s' * #text = 'x'without parentheses worked because the product (truncation) is computed before the comparison. Still, write the parentheses explicitly.{working pack}(Source: AP 4.4) - [EXP-06] An expression that is too deep (
((#c + #t + (#c * #t)) = 964963)) fails. Split it into step-by-step view bindings and put the intermediates in properties. But the CN evaluator computes up to 512 levels of nesting, so the cause of the failure may be types, not depth. If#cand#tare chest quantities they are strings (EXP-17), and string+is concatenation.{measured, inferred}(Source: BC-S14, CN-run) - [EXP-28] Do not write comparisons as a chain.
(a < #v < b)is((a < #v) < b)so it is always true (or always false). Write((a < #v) and (#v < b)). In a Windows 1.26.65.1 measurement the chained comparison gave a wrong true. However((5 < x) and (x < 7)), with the literal on the left, gave no value while((x > 5) and (x < 17))worked (cause not separated, measurement record).{code (source), measured}(Source: CN-run, 2026-11-18 Windows 1.26.65.1) - [EXP-29]
andandorhave the same precedence and are computed from the left.a or b and cis(a or b) and c. Use parentheses when mixing. For a parenthesized(not X)used as an operand ofand/or(((not (#v = 'a')) or (#v = 'b')),((not (#v = 'a')) and (not (#v = 'b')))) and fornotapplied to a parenthesizedandgroup ((not ((#v = 'a') and (#v = 'c')))), two measurements disagree. A measurement inside a server form window on 2026-11-18, Windows 1.26.65.1, gave no value (measurement log). A measurement on the HUD on 2026-12-04, Windows 1.26.65, reading#hud_title_text_stringinto#visible, gave the right value for both titlesaandc. Which condition makes them fail was not determined. The forms that worked in both measurements are(not (#v = 'a') or (#v = 'b'))without parentheses around the not term,(((#v = 'a') = false) or (#v = 'b')), a plain(x or y or z)with three terms, andnot (#v = 'a')alone. Use these forms to be safe.{code (source), measured, conflict}(Source: CN test E12, 2026-11-18 Windows 1.26.65.1, 2026-12-04 Windows 1.26.65) - [EXP-51]
and,orandnotare operators only in lowercase. Other spellings such asANDbecome string values, so several values are left in that parenthesized group and the group becomes null (EXP-52). On Windows 1.26.65.1('E11=' + (1 AND 1) + 0)wasE11=0.{measured, code (binary)}(Source: NB, 2026-11-20 Windows 1.26.65.1) - [EXP-52] If a parenthesized group does not end with exactly one value, the result of that group is null, and the outer expression keeps computing with that null as a value.
(#one #one)(two values) and(1 AND 1)(three values) are such groups. The text of null is empty, so('E11=' + (1 AND 1) + 0)becomesE11=0. The engine code leaves no log in this case. This differs from a parse failure that empties the whole expression (EXP-53).{measured, code (binary)}(Source: NB, 2026-11-20 Windows 1.26.65.1) - [EXP-36] Tokens break only at spaces, parentheses,
$and* + - / < = >. Using-in a property name makes it subtraction, so use_.:and.may be used in names.{code (source)}(Source: CN test E05) - [EXP-37] Unary
-on a string is 0 ((-#s)is 0). Unary-andnotattach only to the operand right after, so(not #a = #b)is((not #a) = #b).{code (source)}(Source: CN-run, CN test E08) - [EXP-53] Unary
+leaves a number as it is and turns a string into 0. On Windows 1.26.65.1(+'abc')was 0,(+#one)was 1 and(-#one)was -1. A parenthesized group right after unary+makes the whole expression fail:(+(#one = 1))emptied the whole expression and leftInvalid expressionin the log. To turn a string into a number, use(#v - 0)instead of unary+(EXP-16).{measured, code (binary)}(Source: NB, 2026-11-20 Windows 1.26.65.1) - [EXP-46] An expression containing
%,(#t - (#t % 65536)), was left in#item_id_auxfor a long time, yet item icons were drawn and noInvalid expressionwas left in the content log of the release client (the assert of EXP-02 is a development build record). There was an impression report that the form became faster after changing to(#t - 0)but it was not re-measured. In a Windows 1.26.65.1 measurement window, by contrast, six rows including two with%gave no value and each load printed 6Invalid expressionlines; rows and lines were not matched one by one (measurement record).{measured, inferred}(Source: DF, 2026-11-18 Windows 1.26.65.1)
Handling strings
- [EXP-07] Containment check:
(not ((#s - 'X') = #s)). IfXis contained, the erased result differs from the original. It is independent of position so there is no need to compute field boundaries.{working pack}(Source: BA chapters 2 and 3.3, AP 4.1, BW-form, BW-title) - [EXP-08] Prefix check:
(('%.Ns' * #s) = 'X'), N is the byte length of X. Short flags (t/f) must be cut and compared at length+1 so that a long value starting withfis not mistaken:(('%.2s' * #v) = 'f').{code (source), working pack}(Source: BC 4.1-(4), BC 6.2-2, AP 4.4) - [EXP-09]
'%.Ns'cuts in UTF-8 bytes. Hangul is 3 bytes and letters and digits are 1 byte. Padding and truncation of fixed-width fields are computed by bytes. Padding formats such as%7.4s,%-7.4sand%4.2sreturned the input unchanged on Windows 1.26.65.1, with no truncation and no padding (measurement record).§is 2 bytes and most emoji are 4 bytes (EXP-24). For padding formats, see EXP-25.{measured, code (source), working pack}(Source: BA 3.1utf8Lengthencoder, MJ 4.2-9, BW-intro, CN-run) - [EXP-10]
'%.Ns' * Xcuts bindings (#…), expressions containing bindings (('%.7s' * (#text - ('%.6s' * #text)))) and string literals alike. On Windows 1.26.65.1(('%.3s' * 'abcdef') + (#v - #v))wasabc. Removing the#property from the same expression makes the binding fail withMust define a source property name in the binding!(BND-05, measurement record). A creation-time constant expression"$cut": "('%.3s' * 'abcdef')"is also cut toabc. The CN evaluator also cuts literals.{measured, working pack}(Source: BC-facts, AP 4.5, CN) - [EXP-11] Taking L bytes after N bytes is done in three steps.
{working pack}(Source: BA 3.2, AP 4.5)
{ "binding_type": "view", "source_property_name": "('%.210s' * #form_button_text)", "target_property_name": "#head" },
{ "binding_type": "view", "source_property_name": "(#form_button_text - #head)", "target_property_name": "#rest" },
{ "binding_type": "view", "source_property_name": "('%.120s' * #rest)", "target_property_name": "#raw" },
{ "binding_type": "view", "source_property_name": "(#raw - '$')", "target_property_name": "#field" }
- [EXP-12] String
-erases every occurrence. So padding characters ($, etc.) and reserved characters must not appear in the body, and the encoder must remove them in advance. For the same reason(#s - #head)also erases the same string as#headif it appears later again. Make the head part long and unique enough. On Windows 1.26.65.1'xaxbx' - 'x'wasaband'abab' - 'ab'was an empty string (measurement record).{measured, working pack}(Source: BA 3.2, AP 4.5) - [EXP-13] The trick of erasing only the first N bytes,
(('@' + s) - ('@' + ('%.3s' * s))) - '@'. On Windows 1.26.65.1,(('§_' + ('@' + #v)) - ('@' + ('%.3s' * #v)))onabcabcwasabc(only the first three characters went). The plain cut(#v - ('%.3s' * #v))erased bothabcand gave empty (measurement record). The final- '@'also erases any@in the body, so choose a character not in the body.{measured}(Source: MJ chapter 8-6, 2026-11-19 Windows 1.26.65.1) - [EXP-14] Attach a terminator to containment check tokens (
name.1b;) and design them so no prefix or suffix relationship arises among tokens.X.1b;also matchesaX.1b;. If built like an uppercase group + lowercase bit (~Fo,~Xa), there is no prefix relationship among them.{working pack}(Source: AP 4.1, BA 3.3) - [EXP-24] UTF-8 byte counts: U+0000~U+007F 1 byte (letters and digits), U+0080~U+07FF 2 bytes (including
§), U+0800~U+FFFF 3 bytes (Hangul, private-use-area glyphs), U+10000 and above 4 bytes (most emoji). When doing a prefix check (EXP-08) on a title with color codes, count N taking into account that one§ais 3 bytes. If you cut in the middle of a multibyte character, that character is not drawn. On Windows 1.26.65.1§was cut as 2 bytes, Hangul as 3 and emoji as 4, and a cut in the middle of a character also dropped the character concatenated right after it (measurement record).{measured, code (source)}(Source: BW-intro, the UTF-8 spec) - [EXP-25] The only working format specifier is
'%.Ns'(first N bytes). Theprintf-style padding formats ('%N.Ms','%-N.Ms','%Ns','%-Ns','%0Ns') neither cut nor pad and return the input unchanged: on Windows 1.26.65.1%7.4s,%-7.4s,%9s,%-9s,%09sand%4.2sall did (measurement record). The CN evaluator also recognizes only the%.Nsform. Padding of fixed-width fields is done by the encoder (script) and the UI only cuts.{measured, code (source)}(Source: BW-intro "Format Specifiers", CN-run) - [EXP-45] If the server writes the cell count in the first 12 bytes of the body as
§r§r§r+ a three-digit number, the number can be taken out with the single expression((('%.12s' * #form_text) - '§r') - 0)and put into#maximum_grid_items. Comparing a single digit character ('3') with a character using=did not match (EXP-34), and changing it to letters a~f matched. The body label subtracts these 12 bytes with(#form_text - ('%.12s' * #form_text)).{measured}(Source: DF)
Numbers and types
- [EXP-15] The engine decides the type of an expression result by its appearance. A string that looks like a number (
'0','3/17','12') becomes a number and string comparison goes wrong. Put a letter prefix on values that must not be interpreted as numbers: flagst/f, tab numberTa, progress§f3/17, percentP050. A string with letters mixed in ('a123') does not become a number even with arithmetic. Cause: the result string of an operation is reinterpreted (EXP-30).{code (source), working pack}(Source: BC 4.1-(4), BA 3.1, BW-type, CN-run) - [EXP-16] The sure way to turn a string into a number is
(#v - 0).(#v + 0)becomes concatenation ('350'). Do not use(#v * 1): string*number is an empty string (EXP-31). On Windows 1.26.65.1('4' * 1)was an empty string,(('4' * 1) = 4)false and(('4' - 0) = 4)true. A pack where* 1works applies it to an operand that is already a number ('042'cut with'%.3s'is immediately the integer 42, EXP-30).(0 + #v)works too: with a chest slot count of 4,((0 + #inventory_stack_count) = 4)was true in game (EXP-17).{measured, working pack, code (source), inferred}(Source: BC-S12, BC-S9, BC-facts, BA-original, AP 4.5, BW-type, CN-run, CPR) - [EXP-17] The
#inventory_stack_countof a chest slot is a string inside expressions. In a slot holding 4,(#count = 4)was false while(#count = '4'),((0 + #count) = 4)and((#count - 0) = 4)were true. To compare with a number, convert first with0 +or- 0(EXP-16). With a count of 1 the value is empty, so(0 + #count)is 0 (TXT-12). Even binding it directly totextas vanilla does does not display (so the lang key workaround of TXT-12 is needed).{measured}(Source: BC-facts, CN-run, CPR) - [EXP-18] Arithmetic is integer-centered. A decimal literal with a leading digit is an integer (EXP-27):
0.3is 0 and0.001is 0, so((#v = #v) * 0.3)was 0 and(#t * 0.001) = 1was false. A real literal starts with a dot like.3. Division of integers(#v / 100)and(#v / 100.0)is also an integer, so to make a 0~1 value such as#clip_ratiofrom an integer, use(#v * .01). Integer arithmetic is 32-bit (int32) and wraps on overflow: on Windows 1.26.65.12147483647 + 1was -2147483648 and65536 * 65536was 0 (measurement record). For integer literals and strings outside 32 bits, see EXP-50.{measured, code (source), code (binary)}(Source: BC-S12, BC-S14, BA-original, CN, CN-run, NB, 2026-11-19 Windows 1.26.65.1) - [EXP-19] A boolean is
true1 andfalse0 in arithmetic. Make a factory length 0/1 with((#mode = 'on') * 1).{measured}(Source: BC-facts, BC-S11, BW-type) - [EXP-20] There are no floor and remainder operators (
%gives no value, EXP-02). Build a remainder from integer division: on Windows 1.26.65.1((#v - 0) - (((#v - 0) / 5) * 5))gave 2 for 17, and on numeric channel integers(#v - ((#v / 5) * 5))gave 3 for 13 and -2 for -7 (EXP-38, measurement record). So fields packed into one number can be split out with expressions (bit extraction, EXP-39, was not measured). Sending several values as string fields or several channels also works.{measured}(Source: BC-S14, 2026-11-24 Windows 1.26.65.1) - [EXP-26] A result left with only numbers after string subtraction could be used as a number as is: putting
(#count - 'Count:' + 0)into#collection_lengthwith the titleCount:3created 3, and putting it into#maximum_grid_itemswithCount:15created 15. This differs from S12 saying that doing+ 0on the original bound string concatenates ('35' + 0gives'350'), so treat it as a case where the type of an intermediate result of an expression is decided again by appearance (EXP-15). To be sure, write((#count - 'Count:') - 0).{measured, inferred}(Source: BW-dyn, 2 screenshots, BC-S12) - [EXP-27] A decimal literal with a leading digit is an integer.
0.3,1.0and100.0are 0, 1 and 100. A real literal starts with a dot like.3and.01. Division of integers is an integer. Make ratios with(#v * .01). On Windows 1.26.65.1, 10 times0.3was 0, 10 times1.5was 10, and(((#v - 0) * .3) = 3)was true (measurement record). On 100,(((#v - 0) * .01) = 1)was true and((#v - 0) * 0.01)was 0. The literals100.0and4.5were integers too (100, 4), but the JSON variable value"$hm": 100.0stayed real, and((#v - 0) / $hm)on 50 was 0.5 (measurement record)."$max": 20.0also stayed real: thevisibleexpressions(((20.0 - 15) / $max) > .2)and(... < .3)were both true, and the same expression with#zadded and written to#clip_ratioclipped the bar by 0.25. The literal20.0is the integer 20, but the result is the same (2026-11-24).{code (source), measured}(Source: CN, CN-run, BC-S12* 0.3gives 0, 2026-11-24 Windows 1.26.65.1) - [EXP-30] A result string of an operation is reinterpreted. If it starts like a number, the leading integer (
'3/17'gives 3,'10 apples'gives 10. A number outside 32 bits becomes a float (EXP-50)), ifyes,no,trueorfalse, a boolean, and if it starts with#, a property name. So'042'cut with('%.3s' * #s)is immediately the integer 42.{code (source)}(Source: CN-run) - [EXP-44] If the cut-out front part starts with a digit, it is read as a number (EXP-30, the same in game): on the body
042§r§r§r…,(#form_text - ('%.12s' * #form_text))could not erase the body and broke. Put numeric fields after letters (§r§r§r042).{measured}(Source: DF) - [EXP-47] The item renderer reads
#item_id_auxonly when it is a JSON integer; text or a fraction draws air (an empty item). So an expression that takes an item number out of text ends with(... - 0)so that the final result is read again as an integer. If an intermediate result starts with a digit, space,+,-or.while the expression runs, only the leading number is frozen into an integer at that point and the rest of the text is dropped (EXP-30, EXP-44). Do not put a number field at the very start of the record; send each field with a letter marker in front, then remove the marker in the last step and apply- 0. A zero-padded number (00042) is read as decimal in the final re-read. Use only 0 to 32767 for the data value (the engine uses the bit above for something else). This was read from the Windows 1.26.63 client and not measured separately in game.{code (binary)}(Source: NB) - [EXP-48] When the text of an operation result is read again, a float read is tried after the integer read, so a result starting with
inf,infinityornan('Info: ...','nancy') may become a float and vanish from a label, and a result starting with0xmay become the integer 0. This is inferred from the behavior of the C standard functions. On Windows 1.26.65.1, results starting with'Info: a','nancy','0x12'and'inf'were empty in the label (measurement record). Make a result that must not be read as a number start with a letter prefix such as§r(EXP-15).{measured, code (binary)}(Source: NB) - [EXP-50] An integer literal outside the 32-bit range becomes a float. A word that cannot be read as an integer is read again as a float, and a float has empty text (EXP-22), so it disappears when concatenated into a string.
('E10=' + 3000000000)wasE10=, and the literals2147483648and4294967296were empty values. The same holds when the result string of an operation is read again (EXP-30): the subtitle string12turned into a number with('' + #s)gave 13 after adding 1, but-8589934591was an empty value the same way. A JSON integer inproperty_bagkeeps only its low 32 bits (-8589934591is 1,2147483648is -2147483648). Do not handle large numbers such as 64-bit entity IDs as numbers in expressions.{measured, code (binary)}(Source: NB, 2026-11-19~20 Windows 1.26.65.1) - [EXP-31] string
*number is an empty string, and number*string is the left number.(#s * 1)and(1 * #s)are not number conversions. The conversion is(#s - 0)or(0 + #s).(#s + 0)appends a 0 at the end. On Windows 1.26.65.1,* 1on'4'gave an empty string and- 0gave 4 (((#v - 0) = 4)true, measurement record).* 1on text cut with'%.3s'is also an empty string: with#sasabcdef,(('%.3s' * #s) * 1)was empty,('B' + (('%.3s' * #s) * 1))wasBand('A' + ('%.3s' * #s))wasAabc(2026-11-24).{measured, code (source)}(Source: CN-run, the same conclusion as EXP-16, 2026-11-24 Windows 1.26.65.1) - [EXP-32] string
/string is the occurrence count (('a-b-a' / 'a')= 2). string/number is always 1. Dividing by 0 leaves the left value as it is. This value is the result of the reconstructed evaluator; in game, string/number froze the Windows 1.26.65 client (EXP-49). String/string did not freeze Windows 1.26.65.1:('a-b-a' / 'a')in a binding expression was 2, and the separator check((#v / 'separator') > 0)was true. It also worked as a containment check inrequiresofvariables, but the same expression inignoreddid not hide the control (measurement record).{code (source), measured}(Source: CN-run, 2026-11-19 Windows 1.26.65.1) - [EXP-33] On a numeric string,
- '0'erases every0('100'becomes 1). To convert to a number, use- 0without quotes.{code (source)}(Source: CN-run) - [EXP-34] Comparing a string and a number with
=is true only when both are falsy values ('' and 0).('2' = 2)is false and(true = 'true')is also false. Match the type of one side before comparing.{code (source)}(Source: CN test E15) - [EXP-54] In
>and<, when only one side is a string, truthiness is compared instead of size.(a > b)is true only when a is truthy and b is falsy, and(a < b)only when a is falsy and b is truthy. So('abc' > 0)is true, and($v > 0)or(#v > 0)cannot tell whether a value is a number (a non-empty string is true). In=, when one side is a boolean both sides are compared as truthiness, so(5 = true)is true. Numbers are compared as float32, so(16777217 = 16777216)is true too. Before comparing a string binding with a number, convert it with(#v - 0)(EXP-16, EXP-34).{measured, code (binary)}(Source: NB, 2026-11-20 Windows 1.26.65.1) - [EXP-55] Dividing by 0 leaves the left value with its type. On Windows 1.26.65.1
((#one = 1) / 0)was the boolean true. When only the right side is a string, the result is 0 (0.0 if the left side is a float):(5 / 'a')was 0 and did not freeze the client. The division that froze was the one with a string on the left (EXP-49).{measured, code (binary)}(Source: NB, 2026-11-20 Windows 1.26.65.1)
Expressions that kill the client
- [EXP-21] Dividing a string freezes the client: in a step-by-step measurement on Windows 1.26.65,
(bool / 100)was fine and(#text / 100)froze (EXP-49). There is also a record of a chest screen using(#count / 19)and('' + #count)together that exited the client as soon as it opened; whether that exit has the same cause was not checked. Vanilla uses empty string comparison like(not (#texture = '')), so comparison is safe. Do not divide strings, and when concatenating use a non-empty prefix like('n=' + #x).{measured, vanilla}(Source: BC-facts, BC-S14, VN server_form.json:159) - [EXP-49] Dividing a string by a number (
#text / 100) freezes the Windows 1.26.65 client. A single view binding('' + (#form_button_text / 100))in a server form button cell made it stop responding, using almost no CPU and never coming back. In the same cell(#text * 1),(1 - #text),(bool / 100)and(#text - ('%.32s' * #text))did not freeze.* 1does not turn a string into a number, so((#a - #b) * 1) / 100is the same expression. Convert with(#v - 0)before dividing (EXP-16). The same expression did not freeze on mobile 1.26.63 (wiki examplejson-ui-performancev1.3.0). It is the likely cause of EXP-21. Even after the conversion it is not certainly safe: on 2026-11-19 Windows 1.26.65.1,((#v - 0) / 5),((#v - 0) / 16)and((x - 0) / 16)on a value taken out by string subtraction gave integers cut toward 0 in one window, but in another window holding other experiments the same expressions froze the client as soon as the window opened, and the cause was not separated. The floor division form that adds or subtracts a comparison product and then divides,((x - ((x < 0) * 15)) / 16), did not freeze but was empty (measurement record).{measured}(Source: step-by-step bisect on 2026-11-18, 2026-11-19, Windows 1.26.65) - [EXP-22] String + integer is concatenated but in string + float the float part is empty and only the string is left. To show a float as text, split ranges with a comparison chain or send it through an integer channel. If you know the range of values, you can get the integer part by adding comparison results like
(0 + (#f > 0) + (#f > 1) + … + (#f > 9)). Cause: the "text" of a real value is empty (CN). The literal1.5is the integer 1, so('n=' + 1.5)is'n=1'(EXP-27). Chest slot durability is a float too, so('D ' + (0 + #item_durability_current_amount))gave only'D 'while a> 100comparison on the same value worked (COL-07).{measured, code (source)}(Source: BC-facts, BW-type, CN-run, CPR) - [EXP-23] The
#item_custom_colorof a dyeable custom item is a signed ARGB integer (0x123456is-15584170). Comparing by RGB value does not match.{measured}(Source: BC-S14)
Conclusions to use directly
Based on CN-run; the game measurements are in each rule.
| What you want to do | Expression to use | Expression to avoid |
|---|---|---|
| A string binding to a number | (#v - 0) | (#v * 1) (empty text), (#v + 0) (a 0 is appended), (1 * #v) (1) |
| Multiply by a decimal | (#v * .3), (#v * .01) | (#v * 0.3) (the integer 0), (#v / 100.0) (integer division) |
| Range check | ((a < #v) and (#v < b)) | (a < #v < b) (always true) |
| Greater or equal | ((#v > a) or (#v = a)), (not (#v < a)) | >=, <= |
| Not equal | (not (#a = #b)) | != |
| Comparing a string and a number | ((#s - 0) = 35) | (#s = 35) (false) |
| First N bytes | ('%.Ns' * #s) | Other formats such as '%5.3s' (do not cut) |
Variables and property names
- [EXP-35] If the result of a parenthesized group is a
'#name'string, it is replaced by the value in that control's bag. So a dictionary lookup result can be compared within the same expression, as in(('#route_' + #id) = 'x').{code (source)}(Source: CN-run, COL-23 reinforcement) - [EXP-56] A string variable starting with
#becomes a property name inside an expression. With"$v": "#one",(#one + $v)was 2. The same log also had the warningExpected variable not found: '$v'. The name lookup happens right at the operand position, not when a parenthesized group ends (EXP-35). Other variable strings are not read again as numbers.{measured, code (binary)}(Source: NB, 2026-11-20 Windows 1.26.65.1) - [EXP-57] A constant expression in a
$variablevalue is computed. Atext: "$cut"label receiving"$cut": "('%.3s' * 'abcdef')"showedabc. The property value resolver, after finding the$value, computes a string starting with(as a constant expression (FILE-48). To use this variable in a binding expression, the expression needs a#property:('R' + $cut)was dropped at load, and(#z + $cut)with"#z": "R"gaveRabc(BND-42).{measured, code (binary)}(Source: 2026-11-24 Windows 1.26.65.1, 2026-11-24 decompilation)
EXP-57 was measured with probe labels inserted into the Windows 1.26.65.1 HUD.
Cinnabar evaluator run results (CN-run)
This section is a result table obtained by building and running the expression evaluator reconstructed by Cinnabar (jb-cinnabar) directly. The values are not game measurements. The analysis base commit is ceb0fb6 (2026-10-21), and they were obtained with test code by building crates/json-ui. If they differ from the game, follow the game measurement.
These are values obtained on 2026-10-21 by building crates/json-ui of Cinnabar ceb0fb6 in this container and running the tests in probe/. They are not game measurements. They are answers of the evaluator Cinnabar reconstructed from the 26.30 native client and may differ from the game.
Binding values: #s=the string "35", #z="100", #c and #n=integer 10, #i=integer 50, #f=real 2.5, #t=true, #x="hello", #r="042x", #k="3/17", #missing=none.
Result notation: Int integer, Num real number, Text string, Bool boolean, Json(Null) an invalid expression (null).
Binding expression result table
| Expression | Result | Meaning |
|---|---|---|
(962 < #c < 964) | Bool(true) | A chained comparison is not a range check. (962 < #c) becomes a boolean and boolean < 964 is always true |
((962 < #c) and (#c < 964)) | Bool(false) | Write a range check split with and |
(#s * 1) | Text("") | string * number = an empty string. The reason the * 1 number conversion fails |
(#s - 0) | Int(35) | string - number: there is nothing to erase so the original remains, and the result is reinterpreted as an integer |
(#s + 0) | Int(350) | The concatenated '350' is reinterpreted as the integer 350. The value is wrong |
(0 + #s) | Int(35) | '0'+'35' becomes '035' and is read as 35. The wiki's alternative also works in this model |
(1 * #s) | Int(1) | number * string = the left number as is |
(#s = 35) | Bool(false) | = between a string and a number is true only when both are falsy |
((#s - 0) = 35) | Bool(true) | Compare after conversion |
(#z - '0') | Int(1) | String subtraction erases every 0 ('100' becomes '1') |
(#z - 0) | Int(100) | Subtracting the number 0 leaves the string as is, 100 |
(#n * 0.3) | Int(0) | 0.3 is read as the integer 0 (the integer prefix takes priority) |
(#n * .3) | Num(3.0) | It must start with a dot like .3 to be a real number |
(#i / 100) | Int(0) | Division of integers is an integer |
(#i / 100.0) | Int(0) | 100.0 is also the integer 100 |
(#i * .01) | Num(0.5) | To get 0.5, multiply by .01 |
(#f / 100) | Num(0.02500000037252903) | If either side is real it is real (float32) |
('%5.3s' * 'abcdef') | Text("abcdef") | A format other than %.Ns does not cut and returns the right side whole |
('%.3s' * #r) | Int(42) | The cut '042' is reinterpreted as the integer 42 |
(('#' + 'x') = 'hello') | Bool(true) | If the result of a parenthesized group is a #name string, that property is read |
('#' + 'x') | Text("hello") | The same for the result of the whole expression (dictionary lookup) |
(#k + '') | Int(3) | the integer prefix 3 of '3/17' |
('' + #k) | Int(3) | Same |
(#t = 'true') | Bool(false) | A boolean and a string are different |
(#t = true) | Bool(true) | |
(#a != #b) | Json(Null) | No !=, so null |
(5 >= 3) | Json(Null) | >= is two operators, so null |
(#c % 2) | Json(Null) | % is not an operator, so null |
('n=' + #f) | Text("n=") | string + real = the real part vanishes |
('n=' + #n) | Text("n=10") | string + integer = decimal concatenation |
(not #missing) | Bool(true) | A missing property is null (falsy) |
(#missing = '') | Bool(true) | |
(#missing = 0) | Bool(true) | |
('abc' = 'ABC') | Bool(false) | Case-sensitive |
('10 apples' + '') | Int(10) | Only the integer prefix remains |
('Yes' + '') | Bool(true) | yes/no/true/false are case-insensitive booleans |
(#s / '5') | Int(1) | string / string = occurrence count |
(#s / 2) | Int(1) | string / number = always 1 (an empty needle) |
('' + #c) | Int(10) | a number becomes a string and then a number again |
(#c / 0) | Int(10) | Dividing by 0 leaves the left value as it is |
(-#s) | Int(0) | Unary - on a string is 0 |
(not 0.5) | Bool(true) | 0.5 is the integer 0, so not is true |
(not .5) | Bool(false) |
Size expression (size string) result table
With parent 200, own width 80 and height 40, children sum 30, largest child 12, largest sibling 50 and content default size 7.
| Input | Interpretation | Result |
|---|---|---|
100c% | Terms([100.0 Percent]) | Pixels(200.0) |
50c% | Terms([50.0 Percent]) | Pixels(100.0) |
10 | Terms([]) | Pixels(-0.0) |
10px | Terms([10.0 Px]) | Pixels(10.0) |
50%cm | Terms([50.0 PercentChildrenMax]) | Pixels(12.0) |
200%cm | Terms([200.0 PercentChildrenMax]) | Pixels(12.0) |
0%cm | Terms([0.0 PercentChildrenMax]) | Pixels(0.0) |
100% - 10px 5px | Terms([100.0 Percent, -10.0 Px, -5.0 Px]) | Pixels(185.0) |
Fill | Terms([]) | Pixels(-0.0) |
fill | Fill | Fill |
DEFAULT | Terms([]) | Pixels(-0.0) |
default | Default | Pixels(7.0) |
100%sm - 4px | Terms([100.0 PercentSiblingMax, -4.0 Px]) | Pixels(46.0) |
56.25%x | Terms([56.25 PercentX]) | Pixels(45.0) |
100 % - 2 px | Terms([100.0 Percent, -2.0 Px]) | Pixels(198.0) |
% | Terms([0.0 Percent]) | Pixels(0.0) |
How to read: "100c%" (used by vanilla progress_screen.json) is 100% of the parent, not %c. A unitless "10" is 0, and uppercase "Fill" and "DEFAULT" are not keywords but 0. %cm is the maximum value itself regardless of the coefficient (50%cm is also 12). A sign carries on to the next sign (100% - 10px 5px = 185).
Variable scope result table
| Test | Result (created children, text) | Meaning |
|---|---|---|
Definition item has "ignored": "$hide" and the reference point a@n.item passes "$hide": true | [("a", "\"A\""), ("b", "\"dflt\"")] | A variable passed at the reference point is not visible to that control's own ignored (a is created) |
The parent root2 declares "$hide": true | [] | ignored reads the outer (parent) scope (c is not created) |
Outer $v fixed value vs inner $v|default | [("a", "\"outer-concrete\"")] | A fixed value beats a default regardless of depth |
Outer $v|default vs inner $v|default | [("a", "\"inner-default\"")] | Between defaults, the nearer one |
"pre $v", "$v", "('pre ' + $v)" | [("a", "\"pre $v\""), ("b", "\"X\""), ("c", "\"pre X\"")] | $v inside a string is not substituted. Combine with an expression |
Techniques learned from AsaJS's expression compiler (ASJ)
AsaJS (jb-asajs, GPL-3.0-only, main 9f884dc) is a framework for making packs in TypeScript. What matters for this wiki is the expression compiler that converts advanced expressions such as ==, !=, >=, % and the ternary ?: into operators the engine knows and auxiliary view bindings. This section re-explains the technique in English and the code was not carried over. Notation: [confirmed] confirmed directly in the code, [inferred] judgment, [unverified] needs game confirmation (AsaJS was not run).
ASJ 3. The binding expression compiler [confirmed]
If source_property_name is wrapped in [ and ], it is a compile target. The result is the original binding and auxiliary view bindings attached before it (the target property names are random #…). The auxiliary bindings come first, so computation order is kept within the same control.
ASJ 3.1 Operator conversion table
| AsaJS syntax | The JSON UI expression it emits | Guide verdict |
|---|---|---|
a == b | (a = b) | Right |
a != b | (not (a = b)) | Matches EXP-03 and the chapter 5 table |
a >= b, a <= b | ((a > b) or (a = b)), ((a < b) or (a = b)) | Matches EXP-03 |
a && b, a || b | (a and b), (a or b) (parentheses every time) | Avoids the same-precedence problem (EXP-29) with parentheses |
-a, !a | (0 - a), (not a) | Turns unary - into binary so the unary - on a string = 0 problem (EXP-37) remains |
a % b | Auxiliary binding #r = (a - (a / b * b)), #r in the main expression | Assumes integer division (4.1). Conflicts with EXP-20 |
c ? x : y | String trick (3.3) | Breaks because of mismatched parentheses |
f'Hello #{#name}!' | ('Hello ' + #name + '!') | String + concatenation |
0x1F, 0b101, 0o17 | Converted to decimal | Right |
1e3, 1e-2 | 1000, 0.01 | 0.01 is the integer 0 in the engine (EXP-27) |
0.5, .5 | Lexer error (a decimal point is not read as a number) | No way to write a real literal, so (#v * .01) for #clip_ratio cannot be written in this syntax |
a < b < c | ((a < b) < c) as is | Does not block chained comparison (EXP-28) |
In a binding that has source_control_name, for each #property in the expression a separate auxiliary view binding is made that "reads this one property from that control", and the expression is computed in its own control. It is a way to safely make expressions that mix several values of another control (the same direction as BND-24 and BND-10).
ASJ 3.2 Functions
| Function | The expression it makes (symbols of this document) | Notes |
|---|---|---|
abs(x), negabs(x) | ((-1 + (x > 0) * 2) * x) | Boolean arithmetic (EXP-19). Right only for numbers |
cache_value(c, o, r) | ((r * c) + ((not r) * o)) | Picking a value by a boolean product. An empty text for strings (EXP-31) |
contains(s, t) | not ((s - t) = s) | Same as EXP-07 |
starts_with(#s, 'lit') | ('%.N s' * #s = 'lit') (N is computed at compile time) | Same as EXP-08 |
starts_with(#s, #p) | Auxiliary #a = (P + #s), #b = (P + #p), main expression not ((#a - #b) = #a). P is 'asajs:<random 5>:' | A new technique (4.2) |
str_slice(#s, i, j) | Auxiliary #t = (P + #s), and cutting off the head with the format ('%.' + (len(P) + i) + 's') | A runtime format string (4.3) |
strlen(#s) | A self-referencing binding that increments by 1 until ('%.' + (n + 1) + 's') * ('a' + #s) equals the whole | Iterative computation (4.4) |
sqrt(x), vector_length(x,y,z) | Newton iteration with a self-referencing binding | Iterative computation (4.4) |
bind(v, #bait) | ((#bait - #bait) + v) | A dependency bait (4.5) |
translatable(#k) | '%' + #k | Uses the %token translation of localized labels (TXT-17) |
new(expression), int(expression) | Pulls the expression into one auxiliary binding | Putting in only literals hits BND-05 |
The parser also has an intToBin that unpacks an integer into 30 bit bindings (the user function bin is commented out) [confirmed].
ASJ 3.3 The defect of the ternary operator
c ? x : y puts the condition into the boolean binding #L as ((0 + c) > 0), puts x and y into auxiliary bindings #M and #R, and then adds the "true side" and "false side" strings. The idea is this: ('prefix' + #L + #M) is prefixtrue… if true and prefixfalse… if false, so erasing the string that arises only when false and then erasing 'prefixtrue' again leaves #M only when true. But the parentheses of the generated string do not match. When this survey rebuilt the same string with Python and counted, the final expression had 8 opening parentheses and 10 closing ones [confirmed]. The dev branch is the same. In the game the expression parse would fail and the target property would stay at its default (the same failure mode as EXP-03) [inferred]. Also, all three operands must contain #, and the result is a string (if it looks like a number it becomes a number again by EXP-30).
ASJ 4. New techniques in detail
ASJ 4.1 Making remainders and bits with integer division [measured, code]
- Remainder:
(a - (a / b * b)).*and/are at the same rank from the left, soa / b * bis(a / b) * b(EXP-01 table). - Bit i:
((x / 2^i) - ((x / 2^(i+1)) * 2)). AsaJS makes 30 bindings for i=0..29. - Premise: both operands must be integers. Guide EXP-18 (measurement S12, CN code) says division of integers is an integer. If so, the EXP-20 statement that "there are no floor and remainder operations, so you cannot pack several fields into one number and divide them back out" must be narrowed to mean that there is no
%operator. - Pitfall: collection and title strings are strings inside expressions. string
/number is 1 (EXP-32). AsaJS does not insert conversions, so using%on a string binding gives a wrong value. When writing it directly, first make a number with- 0as in((#v - 0) - (((#v - 0) / 10) * 10))(EXP-16). - Negative numbers: the engine's division truncates toward 0, so the sign is the same as C's
%(-7 % 3 = -1) [measured]. - Measured (Windows 1.26.65.1): on the string
'17',((#v - 0) - (((#v - 0) / 5) * 5))was 2 and17 / 5was 3.-7 / 3was -2, and the remainder expression of the same form was -1 (measurement record). On numeric channel integers,(#v - ((#v / 5) * 5))was 3 for 13, -2 for -7 and 0 for 20, and13 / 5was 2 (2026-11-24). Bit decomposition was not measured.
ASJ 4.2 Start check and cutting with a unique prefix [code, unverified]
If the length of #p is not known at compile time, '%.Ns' (EXP-08) cannot be used. If you attach to both a prefix P that cannot appear anywhere else, the result changes when subtracting (P + #p) from (P + #s) only when #s starts with #p (subtraction erases every occurrence but P is unique so the occurrence is only the one at the very front). By the same principle, if you cut off the front of a string with P attached, even if the cut head appears again later in the body it is not erased (solving the problem of EXP-12). P must be a string that never appears in the body.
ASJ 4.3 A runtime format string [measured, code, working pack (SLB)]
It builds the format string itself by concatenation like ('%.' + (len(P) + #i) + 's'). StarLibV2 uses the same form with $from/$to variables. Since number + string concatenation has to make a string like '%.12s', it relies on the concatenation behavior of + (the operator table). On Windows 1.26.65.1, (('%.' + #v + 's') * 'abcdef') (#v is '3'), ('%.' + $n + 's') ($n is 3) and ('%.' + '3' + 's') all gave abc (measurement record).
ASJ 4.4 Iteration with self-referencing view bindings [code, unverified]
strlen puts two bindings on the same target, "counter = 0 (when the source changes)" and "counter = counter + (1 if not yet fully counted)". If the first binding also re-runs on every evaluation, the counter stays at 0 or 1. This design presumes the behavior that a view binding rewrites only when its own source value changes, and the chain loops until it converges (the Cinnabar reconstruction CN-36). Putting #s into the source of the first binding, as in (0 * (#s = 'a')), is also a device to make it initialize "only when #s changes". The iteration limit and per-frame throughput were not confirmed. It is not used as a guide recipe before confirming in game.
ASJ 4.5 A dependency bait [code, unverified]
((#bait - #bait) + v) has the value v but is re-evaluated every time #bait changes (the 4.4 premise). With a numeric bait it is 0 + v and with a string bait '' + v, so the result type depends on the bait type (string + number is concatenation).
ASJ 5. Generated JSON compared with vanilla
| Item | Contents | Verdict |
|---|---|---|
| Property names | Of the 328 properties of the type definitions, 46 names are not in vanilla UI (tab_control, tooltip_area, use_uuid, screen_scale, clip_offset, etc.). Most are type declarations from the wiki and schemas and are not output unless used | Check against vanilla before use |
modifications insert_back | Emits value as an object, not an array (insert_front, insert_after and insert_before also object, only insert_front an array) | MOD-01 is an array. On Windows 1.26.65.1 insert_back with a single object also inserted the control at the back [measured] (measurement record) |
replaceChild | Discards the child passed and writes only the property object as value | Defect [confirmed] |
| Factory | Emits variable keys as variables (in practice there is no setter function so it is not output) | COL-08 is factory_variables |
fixInventoryItemRenderer | Wraps the #item_id_aux value of property_bag in the string "(N / 1)" | No explanation of purpose. A parenthesized property_bag string is evaluated: on Windows 1.26.65.1 "#pb": "('A' + 'B')" showed AB, "(1 + 2)" is a number so the label was empty, and "plain" showed plain [measured] (measurement record) |
| Auxiliary bindings | new('lit'), int(3) and str_slice('lit', …) make view bindings without # | BND-05: all bindings of that control are discarded |
| Exponent literals | 5e-1 becomes 0.5 and is read as the integer 0 | Violates EXP-27 |
% | Used as is on a string binding it is wrong by EXP-32 | 4.1 |
Proposed rules
The rules below lack evidence or are not adopted yet. Check the evidence before using them.
-
[EXP-38] (proposal) Make remainders with integer division instead of
%:(a - ((a / b) * b)). It is right only when both operands are integers, so first convert string bindings with(#v - 0)(string/number is 1, EXP-32). Put the computation in one auxiliary view binding and reuse it. On Windows 1.26.65.1,((#v - 0) - (((#v - 0) / 5) * 5))gave 2 for 17, and the same form dividing -7 by 3 gave -1 (ASJ 4.1, measurement record). On the numeric channel (a JSON integer inproperty_bag),(#v - ((#v / 5) * 5))without conversion gave 3 for 13, -2 for -7 and 0 for 20 (2026-11-24). The remainder of a negative number is negative.{measured, code (source)}(Source: ASJ 3.1 and 4.1, CN EXP-18, 2026-11-24 Windows 1.26.65.1) -
[EXP-39] (proposal) To take bit i out of an integer, put
((#v / 2^i) - ((#v / 2^(i+1)) * 2))(compute the power of two as a number in advance) in an auxiliary binding per bit. It lets the bit tokens of PAT-06 be sent as one number instead of a string.{code (source), inferred}(Source: ASJ 4.1) -
[EXP-40] (proposal) A start check for two runtime strings of unknown length: attach a unique prefix
Pthat does not appear in the body to both to make auxiliary bindings#a = (P + #s)and#b = (P + #p), and decide with(not ((#a - #b) = #a)). When cutting off the front part too, cutting from the string withPattached means the same head is not erased even if it appears later (EXP-12).{code (source), inferred}(Source: ASJ 3.2 and 4.2) -
[EXP-41] (proposal) To choose one of two numbers by a condition, use
((#c * #a) + ((not #c) * #b)), and make an absolute value with the sign((-1 + ((#x > 0) * 2)) * #x). It relies on boolean arithmetic (EXP-19) and is not used with string operands (EXP-31).{code (source), inferred}(Source: ASJ 3.2) -
[BND-30] (proposal) There is a generator (AsaJS) that does repeated calculation (counting string length, a Newton square root) by attaching two view bindings to the same target, "initialize" and "itself + increment". The method relies on the premise that a view binding rewrites only when its source changes and the chain loops until it converges (the Cinnabar finding CN-36). The iteration limit and per-frame processing are not checked, so it is not used as a recipe. Self-reference itself worked on Windows 1.26.65.1. On a zero-size HUD panel, a view binding writing
((#st * (1 - (#on + #off))) + #on)back into#stheld the state 1, 1, 1, 0, 0, 1, 1 for the titlesXON a,other,plain,XOFF b,other2,XON c,other3, with no hang and no log error (record). Not checked: whether the iterative calculation that increments by 1 (string length, square root) reaches the final value, and how many frames it takes.{code (source), measured, unverified}(Source: ASJ, CN, 2026-11-19 Windows 1.26.65.1) -
[DBG-23] (proposal) Community UI schemas produce errors on vanilla too. Validating the 205 vanilla 1.26.50.4 files, the Blockception latest source gives 116 errors in 43 files (50 unknown properties), Bugrock (KalmeMarq) 2,224 errors in 186 files (size expression and texture path regular expressions), and the 2025-09 schema bundled in Blockception VS Code extension v8.0.46 2,251 errors in 193 files (rejects
"100%c", negative offsets and size expressions). For a schema error, first grep whether vanilla has the same form to tell whether it is a false positive.{code (source)}(Source: UIS) -
There is a generator function that makes a localized label translate a key by putting
'%'before the binding result (('%' + #key)) (ASJtranslatable, TXT-17).{code (source)}
List of items needing measurement
StarLibV2's range extraction and tab padding (SLB)
StarLibV2 (jb-starlibv2, GPL-3.0, 6bf7875) is a library that uses server form button strings as fields. Only the part about expressions is carried over (key gates and 2D layout are in the collections and factories chapter, and the search filter in the input chapter). The code is not carried over and only the technique is written.
SLB 5. Range extraction and tab padding [confirmed]
range_selection_binding takes $from and $to (byte position numbers) and computes in the following order.
- Make a format string with
('%.' + $to + 's')and cut the first$tobytes. - Cut the first
$frombytes the same way and subtract them from 1. - Erase every tab character (
'\t', an escape inside a JSON string) from the remaining piece. - If the result is an empty string, hide it.
$fromand$toare substituted with numbers at creation time, and the assembly of the format string ('%.' + 10 + 's') happens inside the expression. AsaJS also uses the same form (4.3).- Choosing a tab as the padding character is a choice to avoid EXP-12 (subtraction erases every occurrence). A tab rarely appears in the body and is not visible on screen. It plays the same role as the guide's
$padding (HOST-08). - The subtraction of step 2 also erases the head string if it appears again later in the body (EXP-12). For a fixed-width record the head is long enough that the real problem is rare.
- GrimUI carries five sections, "default text", "side text", "title", "background text" and "tip", in one button this way (
range_controls).
Proposed rules
The rules below lack evidence or are not adopted yet. Check the evidence before using them.
- [EXP-43] (proposal) A format string can be built inside an expression by concatenation:
(('%.' + $to + 's') * #t). The byte range[from, to)is taken out with((('%.' + $to + 's') * #t) - (('%.' + $from + 's') * #t)). If the front piece appears again later it is erased together (EXP-12), so make the head unique. On Windows 1.26.65.1, format strings with N from a binding ('3'), from$nand from literal pieces all gaveabc(measurement record).{measured, working pack, code (source)}(Source: SLB chapter 5, ASJ 4.3) - [HOST-34] (proposal) If you make the title flag by attaching
§to every character (§c§h§e§s§t§5§4§r), every character is consumed as a formatting code, so the flag does not show in the title even when there is no resource pack or the vanilla look is shown. The containment check (EXP-07) still works. Attach§rat the end to undo formatting for the following title.{working pack}(Source: Chest-UI constants.js, upgrader protocol.js)
Type conversion examples (the Bedrock Wiki original and this project's verdict)
The wiki's "Type Conversion" document (CC BY 4.0) shows conversion between strings and numbers with examples. The (#str * 1) in the original below did not work in this project (EXP-16, EXP-31). The wiki also writes under its first example that "from some version the #str * 1 and #str * #float conversions no longer work, but 0 + #str still does". Use (#str - 0) instead. ('Result: ' + #num), which turns a number into a string, works only for integers and a float outputs nothing (EXP-22). Arithmetic that uses a boolean as a number (true 1, false 0) is EXP-19.
Excerpt: Type Conversion (String to Number) · docs/json-ui/type-conversion.md · Bedrock Wiki · License CC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository) · Commit 0930b39String to Number
The following code will create a label that will contain a string data at which will get turned into number.
"label": {"type": "label","text": "#text","property_bag": {"#str": "10",// You don't need to necessarily turn this into a binding// property but it alleviate problems later on the line."#float": 1.0},"bindings": [{"binding_type": "view","source_property_name": "(#str * 1)","target_property_name": "#integer"},{"binding_type": "view","source_property_name": "(#str * #float)","target_property_name": "#float"},{"binding_type": "view","source_property_name": "('Result: ' + #integer)","target_property_name": "#text"}]}The Process
By doing arithmetic operation on strings (except addition), you convert a string into a number.
Notes:
- Instances of strings that is alphanumeric (like
a123) will not return123.- Adding a string and float (like
'abc' + 1.2) will not produce anything.- It is not possible to directly display floats—refer to the Float to String part of the documentation.
- Starting from some version of minecraft the
#str * 1and#str * #floatconversions no longer work, however you can still use0 + #strmethod.
Excerpt: Type Conversion (Float to String, Boolean to Number) · docs/json-ui/type-conversion.md · Bedrock Wiki · License CC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository) · Commit 0930b39Float to String
The following code will create a label that will contain a float data at which will get turned into string.
tipThere is no float to number because floats are a sub-child of numbers, so floats are already numbers by itself.
"label": {"type": "label","text": "#text","property_bag": {"#float": 6.7},"bindings": [{"binding_type": "view","source_property_name": "(0 + (#float > 0) + (#float > 1) + (#float > 2) + (#float > 3) + (#float > 4) + (#float > 5) + (#float > 6) + (#float > 7) + (#float > 8) + (#float > 9))","target_property_name": "#integer"},{"binding_type": "view","source_property_name": "('Result: ' + #integer)","target_property_name": "#text"}]}The Process
It is not feasible to just add a string and a float as that will produce nothing. Therefore, the binding need to guess where the float lies on between the number 1 to 10.
In this process, it also limits itself into only support floats between 1 to 10 and; the output will not include the decimal number. So in this context, it will only output
6, not6.7.Notes:
- There is a way to include the decimal but, it requires a more complex expression.
- The code seen is the simplified version of the concept, there is much more better ways of doing this process.
- This is great if you know the range of your number reference, otherwise, you will need to guess.
Boolean to Number
The following code will create a label that will contain a boolean data at which will get turned into number.
"label": {"type": "label","text": "#text","property_bag": {"#bool": true,"#hahasixseven": false},"bindings": [{"binding_type": "view","source_property_name": "(#bool + #hahasixseven)","target_property_name": "#integer"},{"binding_type": "view","source_property_name": "('Result: ' + #integer)","target_property_name": "#text"}]}The Process
Any arithmetic operations done between booleans and numbers will always result a number. Internally,
trueis recognized as 1, andfalseis 0. Thebooleancan be an expression as long as it results as a boolean.
Number to String. Attach text in front of the number. Only integers work (EXP-22). The original's example applies ('Result: ' + #num) to "#num": 10 in property_bag to make Result: 10. A float outputs nothing.
How evidence is marked and source abbreviations
A rule carries an ID in the form [chapter abbreviation-number], and the {…} at the end is the verification level. The priority of verdicts is measured > vanilla > working pack > code > inferred, and unverified and conflict must be checked before use. C-nn is a number in the conflict table, and the value counts of VN are the tallies in the value dictionary. Rule IDs of other chapters (LAY-, BND-, HOST-, etc.) are on the corresponding pages of the same JSON UI chapter.
| Abbreviation | Material |
|---|---|
VN | Exhaustive search of vanilla resource pack resource_pack/ui v1.26.50.4 (bedrock-samples 46ba6ea). VN file:line is that location |
BC, BC-S1~BC-S14, BC-facts, BC-rules | bedrock-core (@bedrock-core/ui 0.12.1, MIT) and the author's in-game measurement records (aee2bbd) |
BA, BA-original | BedrockAdvancements 2.0.3 (All rights reserved, only techniques carried over) |
AP | AdvancementPack v4.2 (MIT) |
MJ | mcbejsonuimasterAI (no license, only facts rechecked against vanilla) |
BW, BW-intro, BW-dyn, BW-doc, BW-form, BW-btn, BW-type, BW-best, BW-title, BW-ase, BW-ids | Bedrock Wiki JSON UI documents (CC BY 4.0). Respectively Intro to JSON UI, Dynamic Content Generation, JSON UI Documentation, Modifying Server Forms, Buttons and Toggles, Type Conversion, Best Practices, Preserve Title Texts, Aseprite Animations, Numerical Item IDs |
CN, CN-run | Cinnabar (Rust code reconstructing the 26.30 native client) and the results of this project running its evaluator |
NB | Engine behavior analysis of the Android 1.26.52.3 native client library (level code) |
DF | Measurement on Windows 1.26.52 with the research server |
ASJ, SLB | AsaJS analysis, StarLibV2 analysis (both GPL-3.0, only techniques rewritten in English) |
MS | The modal form multiselect survey |
NE | NetEase (China edition) developer documentation |
CPR | Windows measurement with the community report probe pack (research repository community-probe v1.0.0, 2026-11-16) |
| id | Source | License | Commit | Accessed |
|---|---|---|---|---|
repo-guide | JSON UI comprehensive guide (this repository) (guide/) | This project's material | 2026-11-13 | |
bedrock-samples | Mojang bedrock-samples | Minecraft EULA applies, (c) Mojang AB. All rights reserved | 15701fa9 (guide baseline 46ba6ea) | 2026-11-13 |
bedrock-wiki | Bedrock Wiki | CC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository) | 0930b39 | 2026-11-13 |
ms-learn | Minecraft Creator documentation (Microsoft Learn) | CC BY 4.0 (documentation), MIT (code) | a9fd1c0 | 2026-11-13 |
private-research | Private research (-) | - | 2026-11-13 | |
bedrock-core | bedrock-core UI (@bedrock-core/ui) | MIT (confirmed in the repository LICENSE, Copyright 2026 bedrock-core) | aee2bbd (analysis baseline, clone HEAD 51d5cf2) | 2026-11-13 |
advancementpack | AdvancementPack (r4isen1920) | MIT (confirmed in the repository LICENSE, Copyright 2024 r4isen1920) | 0a79929 (analyzed v4.2, researched 2026-10-20) | 2026-11-13 |
cinnabar | Cinnabar (json-ui crate) | PolyForm Noncommercial License 1.0.0 (confirmed in the repository LICENSE). Used only to check behavior and as an implementation reference; the original text is not copied | ceb0fb6 (analysis baseline, clone HEAD df826f5) | 2026-11-13 |
asajs | AsaJS | GPL-3.0 (confirmed in the repository LICENSE) | 9f884dc | 2026-11-13 |
starlibv2 | StarLibV2 | GPL-3.0 (confirmed in the repository LICENSE) | 6bf7875 | 2026-11-13 |