JSON Parser
The JSON Parser is a powerful background utility for your Custom Launcher. It allows you to take raw JSON formatted text—typically fetched from a web API using a Query String or loaded from a local file—and break it down into usable variables and logic triggers.
Because it is a non-visual object, it remains completely hidden from the user at runtime. Instead, it works quietly behind the scenes, acting as the brain that translates complex web data into actionable information for your Custom Game Launcher.
The JSON Parser is exclusive to the Developer Edition. It is designed to work in tandem with variables and network requests to build advanced, data-driven interfaces.
JSON Parser Overview
When you drop a JSON Parser onto your canvas, it appears as a placeholder icon in the editor. At runtime, it becomes an invisible engine that listens for parsing commands, evaluates data structures, and fires off events based on the contents of the data.
Typical Uses
- ❖ Extracting player counts from server API responses
- ❖ Reading custom loadout configurations from local files
- ❖ Triggering maintenance screens if a remote "status" key equals "offline"
- ❖ Populating user profile details after a secure login
Events
The parser utilizes highly specific events that allow you to conditionally execute actions based on the structure and content of your data.
| Event | Description |
|---|---|
| On Parse Success | Fires when the provided string is validated and successfully loaded into the object as usable JSON data. |
| On Parse Error | Fires if the string provided is malformed or invalid JSON. Useful for showing error messages. |
| On Key Exists | Fires when a specifically defined JSON key is found within the parsed object. |
| On Key Equals Value | Fires when a specific JSON key strictly matches a target string or number. |
| On Key Contains Value | Fires when a specified JSON key contains the target substring or element. |
Actions
You control the flow of data in and out of the parser using these dedicated actions.
| Action | How it works |
|---|---|
| Parse JSON From Variable | Takes a raw JSON string stored in a global variable and loads it into the target JSON Parser object. |
| Get Value From JSON Path | Extracts a specific data point using dot-notation (e.g., data.server.players or results[0].name) and saves the result to a global variable. |
Building Logic with the JSON Parser
The parser acts as the middle-man between fetching data and displaying it.
Example 1: Displaying a Live Player Count
Fetch an API and update a text label with the current number of online players.
- Create a Query String to hit your server API. On its onQueryFinished event, use Push to Variable to save the loaded text into a variable named
raw_api_data. - Immediately follow that with the Parse JSON From Variable action, targeting your JSON Parser object and the
raw_api_datavariable. - Select your JSON Parser object. Under its On Parse Success event, add the Get Value From JSON Path action. Set the path to
players_onlineand save it to a variable namedplayer_count. - Finally, use Set Object Property from Variable to push the
player_countvariable into a Text Label on your page.
Example 2: Smart Maintenance Lockout
Prevent users from entering the game if your server API reports that maintenance is active.
- Parse your server status JSON file into the JSON Parser.
- Configure the parser's On Key Equals Value event. Set the Key to
maintenance_modeand the Value totrue. - Under that event, add an action to Change Page and direct the user to a dedicated "Server Under Maintenance" page, effectively locking them out of the main launcher interface.
Custom CSS Note
The JSON Parser is a non-visual object, meaning it does not render on the screen when the launcher is built and running. Therefore, styling it is generally unnecessary for the end-user experience.
However, if you are using the Developer Edition and want to organize your editor workspace, you can apply Custom CSS to style the placeholder icon itself while you are building your layout.
Custom CSS applied to non-visual objects only affects the object placeholder within the editor canvas. It will not have any visual effect in the compiled launcher.
/* Developer Edition Custom CSS Example for JSON Parser Placeholder */
/* Highlights the object in the editor to make logic chains easier to spot */
border: 2px dashed #a855f7 !important;
border-radius: 8px !important;
background: rgba(168, 85, 247, 0.1) !important;
opacity: 0.8 !important;
:hover {
opacity: 1 !important;
background: rgba(168, 85, 247, 0.2) !important;
}
Summary
While the JSON Parser operates entirely out of sight, it is one of the most capable objects in a Custom Game Launcher. By transforming flat text from local files or web endpoints into deeply queryable data, it allows you to build highly dynamic, responsive, and intelligent launcher interfaces.