- 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
String Interpolation
        Hawkmax edited this page Oct 10, 2025 
        ·
        8 revisions
      
    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!
member: { "key": "{#ref:my/path}" } 
key: no implementation
Important
You have to escape { and } in strings.
Use {{ and }} instead.
{ // <-- 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!{}}"
}{ // <-- 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
Back to Repo ● Wiki Home
Copyright © coldrock.games