Skip to main content

JSON UI tester

What it is​

The JSON UI tester is an experimental tool that runs a resource pack's JSON UI without starting the game. It reimplements in JavaScript the engine evidence in this repository (the guide rules, the engine behavior analysis NB, the Cinnabar reconstruction CN), and it is used in two ways: a browser GUI and a command line (cli.mjs). The vanilla baseline is v1.26.50.4 (bedrock-samples 46ba6ea). The results are not game behavior. It is a model that transcribes the engine rules from the documents, so it differs from the game wherever a rule is wrong or not yet known. Final verification happens in game (Source: tool-jsonui-tester, README.md). The license is this project's own material.

Verified capabilities​

What was checkedResult
Expression evaluatorAll 42 results of the Cinnabar evaluator match. Includes byte truncation, chained comparison, * 1 becoming an empty string, 0.3 being the integer 0, and % and >= becoming null
Size expressionsMatches the 16 Cinnabar size expression results ("100c%" is parent %, "10" is 0, 50%cm is the largest child)
Full vanilla loadReads 207 files and 6,276 definitions under ui/ in 0.3 seconds
Vanilla screen resolutionBuilds server_form.third_party_server_screen (107 controls), hud.hud_screen (748) and chest.small_chest_screen (223) with 0 resolution errors
Server form simulationGiven a title, body and buttons, the elements are placed in the right spot following the vanilla layout (a 225x200 window at the center of the screen)
Button pressAnswers selection = N if the button itself has collection_details, and canceled (COL-04) if not
Time flowSimulates once and visibility_changed tick by tick so the preserved title latch works

Installation and use​

Node 20 or later is required and there are no external packages (package.json has "type": "module" and tests run with node --test).

GUI​

node jsonui-tester/serve.mjs # In the browser at http://localhost:5178
node jsonui-tester/serve.mjs 5179 --no-vanilla # Mode that downloads vanilla from GitHub
VANILLA=<resource_pack path> node jsonui-tester/serve.mjs # Specify the vanilla folder

The server automatically finds bedrock-samples/resource_pack next to the repository. On static hosting it downloads vanilla directly from GitHub (Mojang/bedrock-samples): the 207 UI files up front and textures when they are used. The screen is laid out as follows.

AreaWhat it does
Top barEngine model (measurement first / CN as is), platform (desktop / phone), screen size, scale, outline and hidden control view, "treat unknown global #visible as false"
Left "Packs"Add vanilla, your own resource pack folder and the sample pack, and reorder them (the top one merges first)
Left "Files"Edit the loaded UI files and apply them immediately (Ctrl+Enter)
CenterThe screen. Clicking a control selects it, and clicking a button or toggle simulates the engine response. Hover works too
"Restart" / "Next tick"Rebuild the tree / resend the host data while keeping the state
Right "Host"Server form (title, body, buttons), HUD (title, subtitle, action bar), chest (name, slots), raw JSON
Right "Inspect"Control tree, definition chain, rectangle, layer, property bag, bindings, $ variables, resolved properties, diagnostics
Right "Diagnostics"Engine error messages and warnings tagged with guide rule IDs. Clicking one goes to that control
Right "Expression lab"Enter an expression and a property bag to see the value and the pitfalls right away

Command line​

node jsonui-tester/cli.mjs --vanilla ../bedrock-samples/resource_pack --pack ./my_rp \
--root server_form.third_party_server_screen --title "myui:v1 Shop" --buttons "Apple;Bread"

It prints diagnostics and the visible labels (text, position) and exits with code 1 if there is an error diagnostic. --json gives JSON output, --cn the CN model, and --host hud --hud-title T --actionbar A HUD mode. CI or an AI agent can use it as a static simulation after editing a pack.

Tests​

cd mcbe-json-ui-tester && npm test # 118 tests, including 22 checks against measurements

The tester lives in the public repository PresentKim/mcbe-json-ui-tester. .github/workflows/pages.yml uploads the GUI to GitHub Pages every time something lands on main.

What the prototype found​

FindingDetails
The label of recipe 1 can go behind the backgroundThe inner bg_image of bg@common.common_panel has layer: 1, so a sibling label with no layer set (layer 0) is drawn beneath it (LAY-18). The sample pack fixed it by giving the title layer: 2
$variable substitution inside an expressionThe game substitutes the value as one string (BND-33, measured 2026-11-16). The tester substitutes the same way in both modes. A value with quotes keeps the quotes as characters
Checks against 1.26.63 measurementsLabels draw only string values. Chest slot counts 0 and 1 are the empty string, and the durability bindings give the max durability. A touch slot press answers with pick then swap, and a quick move moves directly. The item renderer and live_player_renderer are reported as info at a layer sum of 95 to 98 and as a warning at 99 or more (ANI-38), and a number #entity_id on live_horse_renderer is a warning
Checks against 1.26.65 measurementsDividing a string by a number (EXP-49, freeze) is an error; * number on a string (EXP-16) and an expression in a collection binding's binding_name (BND-37, freeze) are warnings. A grid with fixed grid_dimensions places cells at the grid width divided by the column count (LAY-41). A grid with 3000 or more cells or taller than 30000px is a warning (COL-49)
The MOD-04 warning has to look through to the baseThe bindings of long_form is safe because the base has no bindings. The warning checks the base chain after reading all files
Most vanilla hiding is an engine global valueIf the simulated data does not know a HUD #visible flag, everything shows, so there is an option "treat unknown global #visible as false" (on by default)

Limits​

  • It is not the game. Rules whose evidence is code (NB, CN) are kept as they are, and where they differ from measurement, "measurement first" mode follows the measurement (BND-05 discarding the whole array, MOD-02 ignoring a different path, MOD-03 ignoring variables modifications, LAY-41 fixed grid cell spacing). EXP-10 no literal truncation is used only in the "expression lab" panel. Both can be wrong.
  • The layer sum limit is diagnosed but not applied when drawing. The measured sum counted only ancestors inside the pack, while the tester's sum includes the vanilla chest screen ancestors (about 13 to 43).
  • The engine data is simulated. The bindings a screen controller supplies are only the part found in src/engine/host.js. Item icons are drawn from vanilla textures and block models. The paper doll, scrolling, animation, input focus and sound are not drawn or are only placeholders.
  • Text width comes from a width table taken from the game font. The glyph shapes are a browser font, so they can be off by about 1px, and localization is not done.
  • Only PNG and JPG textures are drawn (no TGA). 9-slice uses CSS border-image and tint uses multiply blending, so colors differ slightly.
  • Expressions that freeze or kill the game (dividing a string by a number, an expression in a collection binding, a non-numeric value in a size binding) are only reported as diagnostics, and the freeze or crash is not simulated.
  • It is based on the vanilla 1.26.50.4 structure. If you load vanilla from another version, it runs with that structure.

Structure​

FileWhat it doesRules it rests on
src/engine/expr.jsTokens, precedence, per-type operations, result reinterpretation, pitfall checksEXP-*, CN-26~30
src/engine/jsonc.jsjsoncpp rules (comments allowed, trailing commas and unquoted keys are errors)FILE-30, CN-01~02
src/engine/size.jsSize expressionsLAY-03, LAY-34~37, CN-47
src/engine/catalog.jsSorted _ui_defs loading, same-path merging, the 11 modifications operationsFILE-20~22, MOD-*, CN-03~13
src/engine/resolve.js@ inheritance, $ scope, variables, ignoredFILE-*, CN-14~25, NB-10
src/engine/bind.jsProperty bag, factory, grid and collection, bindings, button and toggle stateBND-, COL-, INP-*
src/engine/layout.jsSize, anchor, stack, grid, layer, clipping, occlusion checkLAY-*, CN-48~50
src/engine/host.jsSimulated data for the server form, HUD and chest screensCN-59~60
src/render.js, src/app.js, index.htmlBrowser GUI
samples/sample-pack.jsSample pack (guide recipes 1 and 2, preserved title, playground)PAT-01~02, BND-18

What to do next​

Measure the verified-in-game items in the real game and reflect them in the mode rules, collect the global bindings the engine controllers supply per screen, and play back anims along the time axis.

Sources
idSourceLicenseCommitAccessed
repo-jsonui-testerJSON UI tester (this repository) (jsonui-tester/)This project's material2026-11-13
repo-guideJSON UI comprehensive guide (this repository) (guide/)This project's material2026-11-13