Blog

JEXL — a modern expression language powering Navixy’s IoT Logic

As telematics solutions grow more complex, the need for customized, adaptable logic increases. Navixy’s IoT Logic app, powered by JEXL expressions, meets this demand with a simple, flexible approach.

Similarly intuitive and powerful as Excel formulas, JEXL makes it easy to create dynamic rules and real-time automation without heavy coding. In this post, we’ll show how JEXL can accelerate your telematics projects, even if you’re new to scripting.

What is JEXL (Java Expression Language)?

First thing, let’s look at what JEXL actually is, and why we chose it for Navixy’s IoT Logic.

JEXL, short for Java Expression Language, is a lightweight scripting language that enables software applications to evaluate custom logic or formulas at runtime. Simply put, JEXL allows developers — or even technically inclined users — to embed and run expressions within an application without hard-coding the logic upfront. It was developed as part of the Apache Commons library to bring flexible, dynamic computation to Java-based systems without relying on heavy frameworks.

JEXL’s syntax is simple and designed to be familiar — resembling JavaScript or common formula-style expressions — which makes it easy to learn. For example, you can write an expression like 3 + 4 * 2, call object methods, or use conditionals, and JEXL will evaluate it on the fly. Behind the scenes, the application provides a context (such as variables and data objects) that the expression can reference, and JEXL handles the parsing and computation.

What makes JEXL a solid choice for embedded logic?

JEXL offers dynamic expression evaluation, so you can update formulas without recompiling code. It integrates smoothly with Java objects, allowing expressions to call methods or access fields in the given context.

It also supports common scripting features like arithmetic, logical operators, and conditionals. You can even define custom functions or extend its syntax if needed. Still, JEXL intentionally stays focused on expressions and simple scripts — not full-scale programming — making it both powerful and safe for embedding into larger systems.

A mature, reliable solution

JEXL is a mature and well-established tool. Originally developed in the early 2000s and inspired by the expression language used in JSP (JavaServer Pages), it has steadily evolved over the years. The latest 3.x versions bring modern enhancements like the ternary ?: operator, regex matching, and string prefix/suffix operators — features developers now expect. Its syntax has become more JavaScript-like (without the added complexity of things like prototypes), all while keeping a lightweight footprint. In short, JEXL isn’t experimental — it’s a proven, dependable solution for safely executing user-defined logic inside applications.

See how it works. Try JEXL yourself with interactive playground

For those curious about how simple yet powerful JEXL can be for IoT and telematics applications, the JEXL Playground offers an easy, interactive way to explore expressions. You can test and validate logic directly in your browser — no installation or setup required.

Want to give it a try? Here’s the link to open the JEXL playground with an example and play a little bit.

JEXL playground

As you click the link, there’re four key areas, such as Input, Context, Transforms, and Output. Let’s break them down real quick.

Input

Write or paste your JEXL expression here. This represents your logic, formula, or condition. For example, to calculate battery percentage from sensor voltage (11 to 14V), use:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
round((voltage - 11) / (14 - 11) * 100)
round((voltage - 11) / (14 - 11) * 100)
round((voltage - 11) / (14 - 11) * 100)

Context

Define your input data using simple JSON. Think of it as incoming data from telematics sensors — voltage, speed, temperature, etc. Here’s an example:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
{
"voltage": 12.5
}
{ "voltage": 12.5 }
{
"voltage": 12.5
}

Transforms (optional)

You can define reusable functions for complex operations if needed. For instance, a rounding function:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
{
"round": "val => Math.round(val)"
}
{ "round": "val => Math.round(val)" }
{
"round": "val => Math.round(val)"
}

Output

Once your expression and context are entered, this section instantly displays the result. In the example above, the output would be 50, indicating that a 12.5V reading equals 50% battery charge.

Overall, you can tweak the voltage, adjust the formula, or create new expressions to match your IoT logic — perfect for quick validation before implementing rules in Navixy’s IoT Logic.

But this is just the beginning. Beyond simple formulas, JEXL enables advanced interpretations of real-time CAN bus data. Integrators can use expressions to calculate engine torque percentages, analyse brake pressure, or compute fuel usage from injector pulse widths. With built-in support for bitwise operations, it’s also possible to decode transmission states, detect error flags, or identify vehicle events encoded in binary signals — all without writing complex code.

JEXL playground fields explained

To make it easier to get started, we’ve broken down what each field in the playground does — and how it relates to building expressions in Navixy’s IoT Logic.

FieldWhat it doesHow you use it with Navixy IoT Logic
InputExpression or formula you’re testingLogical rules or calculations
ContextIncoming data variables for expressionSimulated IoT device data (voltage, speed, etc.)
Transforms (optional)Custom functions for reuse within expressionsAdvanced calculations or formatting (rarely used)
OutputResult of the evaluated expressionImmediate verification of correctness

The evolution of JEXL from basic formulas to advanced IoT logic

Now, let’s take a closer look at how JEXL was developing.

JEXL was inspired by template languages like Apache Velocity and the JSP Standard Tag Library’s EL. It aimed to let end-users or integrators inject custom logic into enterprise platforms.

Over time, it has evolved into a robust open-source library maintained by Apache, designed with simplicity, performance, and security in mind for embedded scripting. While the name JEXL (short for Java Expression Language) reflects its origins, the syntax has kept pace with modern scripting conventions. As of version 3.3, JEXL supports many familiar constructs from popular programming languages — including && and || logic, ternary conditionals (?:), regex matches (=~), and even the “Elvis” operator for setting default values. These modern features make it easy for developers to write clear, concise expressions.

Because JEXL is part of the Apache Commons project, it’s open source and actively maintained by the community. Regular updates are documented in the release notes — for example, version 3.4.0 was released in mid-2024, introducing features like an instanceof operator and other enhancements. This steady development shows that JEXL continues to evolve with modern developer needs. With a development history spanning nearly 20 years, it’s a mature and battle-tested tool — bugs have been resolved, and performance has been fine-tuned. Designed for efficiency, JEXL is lightweight enough not to strain resource-constrained IoT servers. The library typically adds only a few hundred kilobytes to a project and can evaluate common expressions rapidly, especially when reused or cached.

This maturity is especially important for IoT and telematics platforms. That’s why Navixy relies on JEXL as a stable logic engine — one capable of handling the real-time calculations and validations required in telematics data processing. Over time, JEXL has also introduced safeguards, such as restricting access to specific methods and classes, making it safe to use even when end users define their own expressions. The result is a modern, dependable solution that integrates seamlessly into an embedded IoT workflow.

Why did Navixy choose JEXL over alternatives (MVEL, SpEL, JavaScript)?

It’s worth noting that JEXL is not the only expression language available — there are several others that have been used in Java and IoT environments.

For example, MVEL (the MVFLEX Expression Language) is another powerful embeddable language popular in rule engines and BPM systems. Similarly, SpEL (Spring Expression Language) is used in the Spring ecosystem to configure and evaluate expressions within Spring-based applications.

Each of these languages has a similar goal: to allow dynamic logic execution within a host application. In fact, many rule engine libraries support multiple options. For instance, the open-source Easy Rules engine allows defining conditions and actions using MVEL, SpEL, or JEXL interchangeably, highlighting that all three are recognized choices for embedding business rules.

Navixy opted for JEXL after carefully considering these alternatives. Why JEXL? There are a few reasons we considered.

  • Lightweight and independent. JEXL is a small, independent library with minimal dependencies. It doesn’t require a large framework (unlike SpEL, which is tied to Spring). This makes integration into Navixy’s platform straightforward and keeps resource usage low. In an IoT context, efficiency matters; JEXL’s footprint and performance are excellent, even on modest server hardware. By contrast, embedding a full JavaScript engine (like Nashorn or GraalJS) would be much heavier. An internal benchmark by another IoT platform found that a lightweight expression language could execute thousands of simple scripts in a fraction of the time it takes a JavaScript engine like Nashorn. This means using JEXL helps Navixy scale to many concurrent device data evaluations with minimal latency.
  • Ease of use (familiar syntax). JEXL’s syntax is very similar to what integrators are already familiar with (JavaScript/Java syntax). MVEL’s syntax is Java-like as well, but MVEL can introduce some differences and might be slightly harder to sandbox (and in some cases, it was reported to throw exceptions on missing data, where others might handle it more gracefully). SpEL uses a ${...} or #{...} notation, which is familiar to Spring users but less so outside that world. Navixy felt that JEXL would be more immediately intuitive to a broad range of developers and integrators. One reason the Navixy IoT Logic Expression Language is based on JEXL is to leverage this familiarity. In short, JEXL strikes a balance between being powerful and not esoteric: an integrator writing a formula to compute “Engine Hours” or normalize a sensor value will find the syntax natural.
  • Community and maturity. As mentioned, JEXL has a long history and is backed by Apache with active maintenance. MVEL was very actively developed around a decade ago (and is used in projects like Drools), but its momentum has slowed in recent years compared to JEXL. SpEL is actively maintained but mainly within Spring use cases. By choosing JEXL, Navixy aligns with a tool that has a broad community, ample documentation, and usage across many domains (ensuring any edge cases or bugs are likely well-known and resolved). This maturity is crucial for a platform that thousands of integrators rely on — it means fewer surprises.
  • Focused scope (safety). JEXL is purely an expression evaluator. It doesn’t allow defining complex scripts or multi-step programs (beyond some simple loops or if-else logic within an expression, if enabled). This focused scope is actually a benefit in an IoT rules context: it reduces the risk of someone writing inefficient or dangerous code. It’s easier to sandbox JEXL since you only expose certain objects or functions. By contrast, allowing arbitrary JavaScript might open the door to misuse (like infinite loops or security issues). Other options, such as embedding JVM languages (Groovy, Python via Jython, etc.), were far too powerful (and heavy) for the requirement. JEXL offered just the right level of expressiveness needed for telematics logic, without the excess baggage of a general-purpose scripting language.

As you can see, while alternatives existed (and each had pros and cons in different scenarios), JEXL appeared to be the best fit for Navixy’s IoT Logic, aligning with the project’s goals of being low-code, user-friendly, and robust. For us, it combined the benefits of a scripting engine and the absence of the weight and complexity that other solutions might’ve had.

How JEXL benefits vehicle IoT and telematics system integrators

We’ve touched on JEXL’s maturity and reliability — reasons why many telematics platforms rely on it. Now, let’s break down how it specifically benefits system integrators working in vehicle IoT and telematics.

Custom logic without custom code

Telematics and IoT applications often require complex, custom rules — for example, “alert me if a vehicle’s fuel level drops by more than 10% within five minutes” or “calculate engine runtime based on RPM readings.” Without a dynamic logic engine, integrators would typically have to request custom development or run external scripts to meet such requirements.

JEXL changes that. It enables integrators to define custom logic themselves in a safe, sandboxed environment — no need to modify backend code or deploy external tools.

Built-in flexibility for on-the-fly use cases

When used in platforms like Navixy’s IoT Logic, JEXL lets integrators write mini-scripts or formulas—often in a syntax they already recognize — directly within the platform. This flexibility is a major advantage: the platform can adapt to varying customer needs without firmware updates or backend changes.

For instance, if a fleet operator wants to derive a new metric (say, combining two temperature sensor readings and converting the result to Fahrenheit), they can do it by writing a simple expression in the platform’s UI — no developer intervention required.

JEXL’s JavaScript-like syntax lowers the barrier for users with basic scripting experience. Even the function naming in Navixy’s IoT Logic Expression Language follows camelCase conventions (e.g., value() or genTime()), which will feel familiar to most developers.

Real-time data processing at scale

In vehicle telematics, data flows in constantly — GPS updates, sensor values, diagnostic reports. JEXL allows the platform to process each data point as it arrives, in real time.

This enables integrators to apply smart transformations and filters immediately. For example, using Navixy’s JEXL-powered logic node, one might calculate a battery’s charge percentage from a voltage reading on the fly or detect an abnormal temperature spike by comparing it to the previous value.

Because JEXL is lightweight and fast, these operations don’t slow down data throughput, which is a critical advantage when managing large fleets or real-time IoT deployments.

Simplified maintenance and rapid iteration

JEXL also improves agility from a DevOps perspective. Instead of hard-coding calculations, logic is externalized as editable expressions. When a rule changes — say, adjusting a threshold — integrators can simply update the expression in the UI. No code changes. No redeployments. The new rule takes effect instantly.

This makes it easy to prototype analytics, experiment with ideas, and adapt the system quickly — all without writing Java code or using external tools. In short, JEXL acts as a toolbox for tailoring the platform to diverse project needs, whether it’s computing driver scores, normalizing units, or detecting complex conditions

Safe, controlled customization

One of the standout benefits of JEXL is how well it balances flexibility with control. The platform can strictly define what user-defined expressions are allowed to do — limiting them to safe operations like arithmetic or data access while blocking file I/O or network calls.

Sandboxing ensures that custom logic doesn’t compromise platform stability or security. Apache Commons JEXL provides the necessary hooks to enforce these restrictions, giving integrators the freedom to build — and platforms the power to stay secure.

That’s to say, JEXL offers flexibility without sacrificing performance or safety, which is a sweet spot for IoT integrators aiming to build smart, automated solutions on a telematics platform.

Industry adoption. Expression languages in telematics and IoT

Navixy is not alone in leveraging expression languages to empower IoT and telematics solutions — many platforms offer comparable capabilities to give integrators enhanced control over data processing logic. What sets Navixy apart is its adoption of JEXL, providing integrators with a modern, standard, and intuitive expression language that makes deriving custom insights from telematics data straightforward, without relying on proprietary or overly complex syntaxes.

  • The open-source ThingsBoard IoT platform introduced what they call TBEL (ThingsBoard Expression Language) for writing rule conditions and transformations. TBEL is actually a fork of MVEL tailored for IoT use, with added safety and helper functions . The ThingsBoard team explicitly noted that using a lightweight expression language was far more efficient for most rule evaluations than using a full JavaScript engine or an external script service. This mirrors Navixy’s reasoning — performance and safety at scale are easier to achieve with a focused expression evaluator.
  • Another notable mention is the FIWARE IoT platform (an open source initiative often used in smart city projects). In FIWARE’s IoT Agent Node library, JEXL is recommended as the expression language for transforming incoming measurements . By configuring JEXL as the default, FIWARE allows IoT integrators to write small conversion formulas or conditions that run at the edge of their system, standardizing data before it’s sent upstream. This choice again underscores JEXL’s reputation in IoT circles as a go-to solution for embedded logic.
  • Even beyond pure telematics, expression languages pop up in various automation tools. Industrial SCADA systems, for instance, often embed a formula language for derived values; some IoT cloud services provide rule evaluators (AWS IoT Rules uses a SQL-like syntax for example, which serves a similar purpose of letting users specify conditions and projections on data).
  • AggreGate IoT Platform is another case — it touts its own expression language similar to spreadsheet formulas, which is used in alert triggers, event filters, and data processing pipelines on that platform.

All these instances indicate that to build smart, flexible IoT applications, having an expression or rule engine is considered best practice. Navixy’s adoption of JEXL puts it in line with these industry trends, leveraging a well-known engine instead of reinventing the wheel.

What sets Navixy’s approach apart is the combination of a visual workflow builder (drag-and-drop nodes) with the power of JEXL under the hood. Many older platforms required users to input raw formulas or write scripts in a text field, which could be daunting. Navixy IoT Logic instead presents a friendly UI: you chain together nodes for data source, logic, and output, and only when you need a custom calculation do you enter a JEXL expression in a form. This lowers the barrier because the overall logic is diagrammed visually, and JEXL is used for the granular calculations or checks.

IoT Logic expression language in the Initial attribute node for data transformation

Real-world use cases empowered by JEXL

What kinds of real-world telematics solutions does JEXL make possible? The range is broad—essentially, any scenario that involves deriving new insights from raw device data or applying conditional rules can benefit. Below are a few practical examples.

  • Custom sensor calculations. Not all vehicles or devices directly report the exact metric a customer cares about. With JEXL, one can derive it. For instance, a delivery fleet might install fuel level sensors that report separate readings for two fuel tanks; using an expression, an integrator can calculate a combined fuel level or an average . Another example is battery health: a tracker might only send voltage, but a JEXL formula can translate that voltage into a percentage charge or battery health score (as shown earlier with the 11V=0%, 14V=100% example) . This kind of on-the-fly computation extends the hardware’s capabilities with pure software logic.
  • Unit conversion and data normalization. In global deployments, variations in units and formats are inevitable — one sensor might report temperature in Fahrenheit, another in Celsius, or altitude in feet versus meters. JEXL expressions allow the platform to standardize these values seamlessly. A simple formula can convert °F to °C across all incoming data, so the rest of the system only works with a single unit standard. Likewise, pressure, volume, or nearly any other unit can be converted—for example, value('pressure_psi') * 0.06895 yields pressure in bar. This capability is especially valuable for integrators working with data from diverse sources, as it ensures consistency without requiring separate ETL processes.
  • Event detection and alerts. JEXL can also evaluate conditions to decide if certain events occur. For example, consider a vehicle speeding alert — one company might want an alert any time speed > 100 km/h, another might only consider it a violation if that speed is sustained for over a minute (to filter out short bursts or GPS errors). With an expression language and some state tracking, the integrator can encode these rules. In Navixy’s roadmap, a “Logic” node for conditional branching is mentioned , which presumably will use JEXL to evaluate true/false conditions and route the data accordingly (for instance, speed > 100 && duration > 60 could be an expression to check speeding lasting more than 60 seconds). This highlights how JEXL empowers creating rich alerting logic. Another use case is detecting fuel theft events by checking if fuel level drops more than X liters in Y minutes — a JEXL condition can compare the current fuel reading with a recent historical reading (Navixy’s value('param', index) function even allows referencing past data points easily ). So complex temporal conditions can be evaluated with one expression.
  • Data enrichment and formatting. Sometimes it’s not about calculation or conditions, but formatting data for output. JEXL could be used to format a string (e.g., combine a text status message based on multiple inputs) or to decide which data to forward to which system. For example, an integrator might mark certain GPS locations with custom labels (if inside a geofence, label as “Depot” otherwise “In transit”) using an expression. This kind of logic elevates raw telemetry into meaningful information for end-users. Navixy’s IoT Logic allows sending processed data to external endpoints; with JEXL, one can tailor exactly what gets sent — e.g., only send an alert if a condition is met, or modify the JSON payload structure — all without external middleware.

Let’s look at a real-world case study from a fleet management scenario.

A logistics company wanted to reduce engine idling. Their vehicles reported ignition on/off status and fuel consumption, but they needed to calculate fuel wasted during idling. Using JEXL in an IoT Logic flow, the integrator created an attribute that accumulates fuel usage when the ignition is on but the vehicle speed is zero (i.e., idling).

They wrote an expression that checks: if (ignition == 1 && speed == 0), then add fuelUsed to idleFuelCounter. Over time, this produced a custom KPI for the client—fuel wasted during idle—which was not directly available from any single sensor. This case underscores how expression-based logic allows service providers to deliver unique, value-added metrics on top of standard tracker data.

Many of these examples were previously either impossible or required significant effort—for example, writing custom server-side scripts or asking the telematics platform vendor to implement new features. With JEXL embedded in Navixy IoT Logic, the power is now in the hands of system integrators and solution architects. They can address specialized needs by writing just a few lines of expression code.

Remember our comparison with Excel? Just as power users write formulas to uncover insights from spreadsheets, integrators can use expressions to extract real-time intelligence from telematics data streams

Final word. JEXL to unlock smarter telematics solutions

By choosing JEXL as the core of its IoT Logic engine, Navixy offers system integrators a powerful low-code tool to create smart automation without deep backend changes. JEXL brings together familiarity (JavaScript-like syntax), reliability (Apache-backed), and flexibility (dynamic expression evaluation), making it an ideal fit for the fast-moving world of vehicle IoT and telematics.

For integrators and partners, this means full control over how data is interpreted and used—from defining new metrics and real-time alerts to customizing outputs—all without touching backend code. Navixy’s JEXL-powered implementation follows a broader industry shift: putting the power of logic in the hands of users, not just developers.

As Navixy expands IoT Logic with new features like conditional nodes and triggers, JEXL remains the backbone. It's a solid foundation for advanced, user-driven automation. Whether you're streamlining fleet operations or turning raw data into actionable insight, the flexibility JEXL provides opens the door to faster, smarter telematics solutions.

← Previous articleNext article →
Ready for the most innovative GPS tracking software?
SIGN UP
Recent posts