Skip to main content

$substringAfter

$substringAfter(string?, substring) -> string
Compact type signature<s-s:s>

If string is omitted, the current context value is used.

Browse categories

Source: JSONata

Documentation

Returns the substring after the first occurrence of the character sequence chars in str. If str does not contain chars, then it returns str. An error is thrown if str and chars are not strings.

Examples

Basic usage

  • $substringAfter("Hello World", " ") => "World"

Get the suffix portion of a code

Input

This example uses the eligibility example input. The expression reads plan.planCode and takes the suffix after the dash.

Example input

JSON
{
"memberId": "mbr-3001",
"patientId": "pat-0001",
"plan": {
"planCode": "PLAN-100",
"planName": "ExampleCare Standard"
},
"active": true,
"effective": {
"start": "2026-01-01",
"end": "2026-12-31"
},
"copay": {
"visit": 25,
"urgentCare": 50
},
"deductibleRemaining": 300
}

Expression

$substringAfter(plan.planCode, "-")

Result

"100"