Skip to content

String Interpolation

Hawkmax edited this page Oct 10, 2025 · 8 revisions

Description

Now things get interesting:
With string interpolation, it is possible to create complex RichJson expressions.
This feature becomes especially powerful because interpolations can be nested in RichJson!

Syntax

member: { "key": "{#ref:my/path}" }
key: no implementation

Important

You have to escape { and } in strings.
Use {{ and }} instead.

Example

Before Applyment

{ // <-- root
    "some_struct": {
        "some_value": 30,
    }
    "some_string": "World!",
    "some_path1": "some_struct",
    "some_path2": "some_value",

    "ref_string1": "Hello {#ref:some_string}",
    "ref_string2": "#ref:some_struct/{#ref:some_path2}",
    "ref_string3": "#ref:{#ref:some_path1}/{#ref:some_path2}",
    "ref_string4": "{#ref:some_struct/{#ref:some_path2}}",
    "ref_string5": "some_struct.{#ref:some_path2} = {#ref:some_struct/some_value}",

    "escaped": "Hello {{}World!{}}"
}

After Applyment

{ // <-- root
    "some_struct": {
        "some_value": 30,
    }
    "some_string": "World!",
    "some_path1": "some_struct",
    "some_path2": "some_value",

    "ref_string1": "Hello World!",                  // "Hello {#ref:some_string}"
    "ref_string2": 30,                              // "#ref:some_struct/{#ref:some_path2}"
    "ref_string3": 30,                              // "#ref:{#ref:some_path1}/{#ref:some_path2}"
    "ref_string4": 30,                              // "{#ref:some_struct/{#ref:some_path2}}"
    "ref_string5": "some_struct.some_value = 30",   // "some_struct.{#ref:some_path2} = {#ref:some_struct/some_value}"

    "escaped": "Hello {World!}"                     // "Hello {{}World!{}}"
}

Author’s Recommendation: next read Constructor

Clone this wiki locally