Skip to main content

JSON UI optimization

Everything that makes JSON UI slow is on the client. Even if a server form is heavy, server TPS stays the same and only the screen of the player who opened the form freezes (community reports). This page gathers the performance rules and community reports scattered across other chapters, by the stage where the cost arises. Rule IDs point to the original text in each chapter.

1. Cost comes from three stages​

StageWhat is expensiveHow to prevent it
Creation and layoutCreating controls and computing size and position. It is paid when the screen opens and when a factory recreates cellsignored, factory length 0 (section 2)
Binding evaluationBindings and expressions are re-evaluated according to their conditionsbinding_condition, gathering calculations in one place (section 3)
DrawingVisible controls are drawn every framevisible: false, reducing element count (section 6)

The most common misunderstanding is that visible: false removes the cost. visible only stops drawing and does not stop creation and layout (COL-10). A screen hidden with visible under the server form was fully created and laid out every time any form was opened (measured with 5,546 controls repositioned), and several reports say hidden elements also cost parsing. In the community, many hold that the main cause of lag is bindings rather than layout.

2. Not creating: creation gates​

When there are several screens or tabs, switching from "create everything and hide" to "create only what is needed" has the biggest effect. There are three methods (COL-12).

MethodWhen evaluatedCondition materialCost
ignoredOnce at control creation$variable onlyNot created
Factory #collection_lengthRuntime, binding#binding expressionNot created if 0
visibleEvery frame#binding expressionCreation and layout cost stay

ignored​

  • If "ignored": true or a $variable expression is true, the control is not created at all. There is no binding or layout cost either (FILE-16). The result is the same as remove in modifications.
  • ignored is evaluated only once at creation time and cannot use #bindings (FILE-17). So it is used to turn off a whole vanilla element, or to turn off a feature with a pack setting variable.
  • ignored does not see that control's own $ declarations and reads only the parent scope. Pass the gate variable to the parent and put ignored on the child (FILE-34).
  • As an exception, a control created by the HUD title factory receives the title string as the variable $title_text, so it can be filtered with ignored (FILE-17, COL-17).

Computed length factory (a runtime gate)​

  • If a factory's #collection_length is 0, nothing is created. Putting in a condition converted to 0/1 like ((#title_text = 'my_screen') * 1) makes a gate that "creates that screen only when the condition holds" (COL-11). A full example is in recipe 4 (PAT-04) of Pattern recipes.
  • When there are many screens, pick from one gate with a property_bag dictionary lookup. Put "#route_<title>": ["screen id"] in property_bag and feed the result of ('#route_' + #title_text) into #collection_length, and only that one screen is created from control_ids (HOST-06, COL-22, COL-23). It worked in game measurement without freezing (COL-39).
  • If you put binding_condition: "visible" on the factory length binding inside a hidden layout, the invisible layout did not create button cells (BND-32). But a layout that is visible from the start created the cells on the first frame.

Pitfalls of gates​

  • Inside a layout created by a gate factory, action form button data reached only the cells of grid + collection_name. Fixed collection_index cells and inner factories were empty (COL-40). Build the button list inside a gate with a grid. But in a window created by a router placed in $screen_content of third_party_server_screen, when all the cell bindings were set to binding_condition: "always", fixed cells, toggle cells and inner factories were filled as soon as it opened (COL-47). With the default condition they were empty at first and filled only after switching a tab once. The wiki examples put the router next to server_form_factory inside main_screen_content instead of $screen_content (section 9). In that place too the screens filled as soon as they opened (measured, mobile 1.26.63, 2026-11-15).
  • A factory inside a cell created by a factory was not created at first if #title_text and the length binding had the default condition. Give both bindings always (COL-48).
  • If you always keep a scroll area covering the whole screen outside the router, it took over touches of other forms' buttons and the close button even when empty (LAY-57). Put the scroll area inside the window the router creates.
  • The expressions of every control that can be created must be safe even for wrong input (an empty string, another form's body). A setup in which an expression that puts a string into a numeric property is created in every form froze or killed the client (DBG-19). Make an expression that goes into a numeric property get created only inside a gate that checks the input format.
  • Putting once on the #visible of a layout chosen by title left the previous layout on while the form changed. Keep this binding always (BND-31).

3. Reducing binding cost​

  • Use once for values needed once: a value that only needs to be decided once, like whether a toast icon shows, gets "binding_condition": "once". It is re-evaluated when a factory recreates the control (BND-06). There is also a report that putting once on the factory and grid length bindings of a big form reduced lag and ghost buttons (community report).
  • Do heavy calculations once in one place: do calculations such as string parsing in one place, the parent or a data source control, and have the children take only the result with source_control_name (BND-10). If several places use the same value, put a size-0 data source control at the screen root and have each gate read that value (BND-11).
  • No several bindings on the same target: if you attach several bindings to the same target, they are not merged and the last one wins. Merge them into one expression. A binding that reads and writes the same name (reading #len and writing to #len) becomes a loop, the string keeps growing and memory increases (community report).
  • Keep repetition tricks short: there is a report that the trick of repeating a string with a binding loop stops after about 20 repetitions, and a case-insensitive search that runs a property_bag mapping per character lagged when typing a long input or erasing it (community report).
  • The HUD data channel: even when the HUD is hidden by the inventory, chat, a form or F1, title and actionbar are still processed. With a heavy binding, processing backed up and froze for several seconds up to about a minute. Increase the update interval to 2~4 ticks or put the data control in hud_content. A 10,000-character title also had no problem once user bindings were reduced (community report).
  • One expression for the same expression in every cell: picking a fixed expression per cell number with requires puts as many blocks as there are cells into each cell definition. Keeping one expression in the definition and passing only the position to each cell raised the screen frame rate of a 256-cell HUD from about 4 to 5 to about 22, and of a 512-cell HUD from about 1 to 2 to about 14. At 64 cells no difference could be seen (measured, Binding expression caching).

4. Lists: grid and factory​

SituationWhat to chooseEvidence
Many buttons of the same shapegrid (collection_name + #maximum_grid_items)A report that a grid loaded even 10,000 buttons at once. A button factory of more than 3000 (the stack_panel of vanilla long_form) froze for about 60 seconds even when hidden (community report). A test drawing the same buttons as a one-column vertical stack factory also lagged heavily (COL-49)
One fixed button per cellA fixed collection_index cellA stack that walks whole buttons per row (a 48-cell grid + a material row) took 4~5 seconds to open, while a fixed layout that reads just one button per cell took about 1 second (COL-37, COL-06)
A form with mixed row kindsA row type factoryIt creates a cell for every matching row, so count the cells. Push cells that are not their own row off screen (COL-13)
  • A 2-column grid (30px cells) was fine up to 2000 buttons (about 30000px), and from 3000 (about 45000px) only the scroll range was long and the cells were drawn overlapping at the top. Whether the cause is the count or the height was not settled (COL-49). Beyond that, split into pages on the server.
  • To fix cells in two dimensions, put horizontal stack rows that have collection_name inside a vertical stack. If the cell parent was a panel, every cell drew button 0, and the offset of stack children did not move the cells (COL-50, LAY-56).
  • Factory cost is cell size x count. A screen with hundreds of controls in one node took several seconds to open if all tabs were sent, and it was solved by sending only the selected tab's node (COL-18).
  • Keep only one button per cell. Having both a pressable one and a non-pressable one doubles the controls (COL-37).
  • When there are many buttons, split into pages. But there is a case where a form took about 30 seconds to open even with many pages, so reduce the number of controls built at once before the number of pages (community report).
  • max_children_size is the maximum number a factory creates. A second factory sharing the same data uses up the limit even on invisible items (COL-16).

5. Opening screens fast​

  • Light first tab, defer the rest: merging 3 elements per store card into 1, deferring expensive content of tabs not opened first (button text, 3D block rendering), and opening with the lightest tab took 1.6 seconds down to 0.8 seconds (community report). For tabs, create only the selected one with the gate of section 2.
  • Tabs and selection on the client: if you make tabs and list cells radio toggles and put the details inside the checked state of a cell toggle, it changes without a server round trip and without closing the form. Send the server only actions it must know about, like a proceed button (INP-36). The details can be created by a visible condition factory the first time a cell is chosen (BND-32). The setup is in Server form research screen.
  • Hidden forms also stay in memory: there is a report of merging into one toggle rather than hiding several forms with different styles (community report).
  • Turn off open animations: giving third_party_server_screen "$screen_animations": [] and "$background_animations": [] makes the form appear immediately without animation. On a screen where the menu is visited often, the next form does not overlap or flicker (HOST-43).
  • The rule of thumb that about 75 elements is fine was shared (community report).

6. Drawing cost​

  • For elements you never use, turn them off with ignored: true rather than visible: false. visible: false keeps processing so an FPS cost remains (FILE-16, community report).
  • Border markers such as "debug": "red" for checking layout are costly. Remove them when done checking (community report).
  • To hide only itself while keeping the children, use alpha: 0 + propagate_alpha: false. A child's alpha is multiplied by the parent's alpha (community report).
  • If the text of a list in a scroll area looks empty until something touches it, it is a layer problem, not lag. It happens when a label is on the same layer as the background image. Put the icon on layer: 2 and the label on layer: 3, above the background (LAY-55). Changing binding conditions or expressions did not fix it.

6.1 Measured: setups that cut the control count​

Windows 1.26.65.1, 2026-11-18. A grid of 4x4 cells in a server form window received as many buttons as cells. The measurement add-on is the one from Measuring unverified JSON UI claims, and the window opens with /scriptevent bwiki:json_ui_claims perf <variant> <button count>. The add-on's grid is 60x40 (2400 cells). Control and binding counts are for the whole screen (including about 162 elements and 68 bindings outside the window). FPS was read three times, 1.5 seconds apart, from the F3 panel with the game window in front (vsync off; for comparison, the HUD gave 177 to 194 and a small form 142 to 178).

VariantCell setup600 cells controls600 cells bindings600 cells FPS2400 cells controls2400 cells FPS
a10 images per cell, each showing through its own #visible expression6714 or morenot countable129 to 1418192 or more (tool count limit)114 to 115
b1 image per cell, #form_button_texture into #texture762668127 to 1412562125 to 143
f1 label per cell, the 16-character button text as is762668144 to 146256281 to 85
e1 label per cell, a 4-character fixed-width field cut out with '%.Ns' and minus7621268143 to 1562562127 to 128
dstatic image cells, no clipping76268131 to 1482562126 to 130
cthe same grid as d inside a 40x40 panel with clips_children50468141 to 196834146 to 158
  • At 600 cells the differences between variants were about the size of the run-to-run spread (about plus or minus 10). They showed at 2400 cells.
  • Merging same-shaped controls into one #texture (DBG-17): a cell that shows one of 10 images had almost 9 times as many controls, and at 2400 cells its FPS (114 to 115) was lower than one #texture image (125 to 143). When the picture to choose is in the data, use one #texture binding instead.
  • Drawn character count: a label drawing the 16-character button text as is (f) was much slower at 2400 cells than one drawing a 4-character slice (e), 81 to 85 against 127 to 128, even though e had one more binding per cell. At this size the drawn characters cost more than one binding.
  • Fixed-width records (HOST-08): the view binding that cuts out the field added one binding per cell (668 to 1268 at 600 cells), yet the frame rate did not drop. Because of the character count difference above, the binding cost alone could not be separated.
  • clips_children: only 341 of 600 cells, and about 672 of 2400 (834 minus the 162 outside the window), were in the control tree for the grid inside the clipping panel, down to a little over one row below the visible rows. The unclipped grid had every cell. Its FPS was also the highest. Whether the engine did not create the clipped cells or the measurement tool could not read them was not separated (inferred).
  • Screen flags: low_frequency_rendering: true (d at 2400 cells 124 to 132) or render_only_when_topmost: false (122 to 125) on third_party_server_screen left the FPS unchanged (126 to 130 without them). cache_screen: true and load_screen_immediately: true did not change the open time either (about 0.7 to 1.3 seconds from Enter to the screen change).
  • A grid seemed to create every cell of grid_dimensions even with a #maximum_grid_items binding (600 buttons into a 60x60 grid went past the 8192 control limit). This was not checked separately.

7. Checking order​

  1. Count how many controls are created for one screen. In-game debug overlays (Conduit Client, etc.) show element and binding counts, the factory tree and FPS (community report).
  2. Replace big chunks hidden only with visible (other screens, other tabs) with the gates of section 2.
  3. Turn button lists into a grid or fixed cells and reduce the number of controls per cell (section 4).
  4. Gather bindings that do the same calculation in several places into one data source, and put once on values that do not change (section 3).
  5. Defer expensive content that is not visible on the first screen (section 5).

8. Sub-plans​

Two plans apply the rules of this page to a server form button list, and one covers how to write expressions for screens with many cells.

DocumentWhat it covers
Grid button listA router builds a window, a scroll area and a 2-column grid only for this form and draws thousands of buttons (sections 2 and 4), with an example add-on
Filling the first frame without alwaysPutting the label bindings of a grid cell in collection then view order to drop always, a measured comparison with the old always cells, and the steps to move over
Binding expression cachingKeeping one expression in the definition and passing only the position to each cell, with the measured cost of 64 to 512 cell HUDs

The two setups compared on the same grid (Windows 1.26.65, 2026-11-18, measured). The full figures and conditions are in Filling the first frame without always.

What to look atLabel bindings with alwaysCollection then view, no always
First frameFilledFilled
fps with the list open (VSync off, world alone about 294)About 284About 290
Longest frame while opening (2000 buttons)43ms43ms
Raised to 20000 buttonsfps with the list open stays the same, the opening stall grows with the count (about 270ms at 20000)Same. Always about 6 to 8 fps above A

9. The shared server_form.json of the server form examples​

The five server form examples of this wiki (the example add-on of the grid button list, the two versions of the server form research screen, and Item Icon Slots and Item Aux Probe of item numeric IDs) do not redeclare third_party_server_screen. Their server_form.json is byte-identical across the five packs except for the one router line inserted into main_screen_content. Below is the file of the grid button list example.

rp/ui/server_form.json
{
"namespace": "server_form",

"main_screen_content": {
"size": [ "100%", "100%" ],
"modifications": [
{
"array_name": "controls",
"operation": "insert_back",
"value": [ { "jup_router@jup.screen_router": {} } ]
}
]
},

"long_form": {
"modifications": [
{
"array_name": "bindings",
"operation": "insert_back",
"value": [
{ "binding_name": "#title_text", "binding_condition": "always" },
{
"binding_type": "view",
"binding_condition": "always",
"source_property_name": "(not (('%.6s' * #title_text) = '§b§w'))",
"target_property_name": "#visible"
}
]
}
]
},

"long_form_scrolling_content/wrapping_panel": {
"visible": false,
"bindings": [
{ "binding_name": "#title_text", "binding_condition": "always" },
{
"binding_type": "view",
"binding_condition": "always",
"source_property_name": "(not (('%.6s' * #title_text) = '§b§w'))",
"target_property_name": "#visible"
}
]
},

"long_form_dynamic_buttons_panel": {
"bindings": [
{
"binding_name": "#form_button_contents",
"binding_name_override": "#collection_length",
"binding_condition": "visible"
}
]
}
}
  • Vanilla main_screen_content has size: [0, 0] (VN server_form.json:22). Left as is, a router inserted into it gets no size either, so it is widened to ["100%", "100%"] (inferred).
  • The router goes in next to server_form_factory through modifications. The routers of several packs stack in the same place.
  • When the title starts with the shared prefix §b§w, vanilla long_form and its body text are hidden. § is 2 bytes in UTF-8, so ('%.6s' * #title_text) cuts out §b§w. The length binding of the vanilla button list has the visible condition, so a hidden form builds no button cells (BND-32).
  • size and the hiding bindings override vanilla definitions, so they compete with other packs that write the same definitions (MOD-13). The five examples write the same values, so the result is the same whatever the pack order (HOST-51).
ExampleTitleLength the router cuts
JSON UI optimization (grid button list)§b§wjp:J('%.10s' * #title_text)
Server form research screen§b§wrs:Fa, §b§wrs:Fb, §b§wrs:Ga, §b§wrs:Gb'%.11s'
Server form research screen (texture version)§b§wrt:Fa, §b§wrt:Fb, §b§wrt:Ga, §b§wrt:Gb'%.11s'
Item Aux Probe§b§wap:scan'%.13s'
Item Icon Slots§b§wis:slot, §b§wis:ent'%.13s' (is:slot)

A title is §b§w + a two-letter add-on code + : + a key. The router cuts the start of the title by byte count, as in ('#' + ('%.10s' * #title_text)), and looks it up as a property_bag key (HOST-06, COL-22, COL-23).

In a jsonui-tester check with all five resource packs loaded, each title showed only its own window with 0 diagnostics. A plain title showed the vanilla form, and an unknown §b§w title showed nothing. With all five behavior packs on in one world in game, each example opened its own screen and worked, and the screens filled as soon as they opened (measured, mobile 1.26.63, 2026-11-15).

IDPageContents
FILE-16, FILE-17, FILE-34Files and definitionsThe meaning, evaluation time and scope of ignored
BND-06, BND-07, BND-10, BND-11, BND-31, BND-32, BND-37Bindingsonce, binding order, gathering calculations, data sources, gate binding conditions, filling the first frame without always
EXP-16, EXP-49ExpressionsTurning a string into a number, dividing a string by a number freezes
COL-10 ~ COL-13, COL-16, COL-18, COL-22, COL-23, COL-37, COL-39, COL-40, COL-47 ~ COL-50Collections and factoriesCreation gates, factory and grid cost, dictionary lookup, data inside a router window, grid limits
LAY-55 ~ LAY-57Controls and layoutText layers, offset inside stacks, touch of scroll areas
INP-36Input, buttons and togglesClient tabs and selection
HOST-06, HOST-43, HOST-51Screen hosts and data channelsScreen routing, open animation, the shared convention of the server form examples
MOD-13Modifying vanilla screensUsing only modifications that define nothing
DBG-19Debugging, verification and version managementSafety of expressions created in every form
PAT-04Pattern recipesA computed length factory example

The evidence for items marked "community report" is private research (community conversations) and is at the level of a report by one or more people. Figures differ by device and version, so measure again on your own screen.

Sources
idSourceLicenseCommitAccessed
repo-guideJSON UI comprehensive guide (this repository) (guide/)This project's material2026-11-13
private-researchPrivate research (-)-2026-11-13
bedrock-samplesMojang bedrock-samplesMinecraft EULA applies, (c) Mojang AB. All rights reserved15701fa9 (guide baseline 46ba6ea)2026-11-13