+
Skip to content

Backslashes (\) Are Removed During JSON Conversion of PlanDefinition StructureMap #334

Open
@sharon2719

Description

@sharon2719

Problem

When converting a PlanDefinition StructureMap to JSON, backslashes (\) inside string literals are being stripped out. This affects expressions such as:

$this + '7 \'days\''.toQuantity()

which should be preserved in the JSON output as:

{
  "variable": "bcgEndDate",
  "transform": "evaluate",
  "parameter": [
    {
      "valueId": "patientBirthDate"
    },
    {
      "valueString": "$this + '7 \\'days\\''.toQuantity()"
    }
  ]
}

However, the backslashes are being removed, causing incorrect JSON formatting and potential failures in evaluation.

Expected Behavior

  • The conversion process should preserve escape characters () within string literals.

  • The JSON output should correctly represent expressions without altering or stripping necessary escape sequences.

Solution

Update the JSON conversion logic to ensure backslashes are properly escaped.

Add test cases to verify that expressions containing single quotes within strings remain correctly formatted.

Impact

Without this fix, expressions may break during execution, leading to incorrect evaluations.

Ensures FHIR-compliant transformation and prevents potential runtime errors in downstream processing.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载