$v2json
$v2json(hl7MessageText) -> objectSource: FUME
Documentation
Parses a raw HL7 v2 ER7 message string into the normalized JSON object shape used by the engine.
If the entire request body is HL7 v2 and the request Content-Type is set to HL7 v2, FUME already normalizes that payload before your expression runs. In that case you usually do not need $v2json().
Use $v2json() whenever you have an HL7 v2 message as a raw string during evaluation and want to parse it. That string might come from a JSON property, an array of message strings, a resolved resource, or another mapping or helper function. For details about the normalized output shape, see HL7 v2 input.
Examples
Parse embedded HL7 v2 message strings
Input
This example uses JSON input on purpose. The HL7 v2 messages are stored inside the object as raw strings, so they are not normalized automatically before evaluation. The same pattern applies anywhere else you end up with an HL7 v2 string inside an expression.
{
"feedId": "adt-batch-2026-03-18",
"messages": [
"MSH|^~\\&|EXCARE|EXCARE-CLINIC|FUME|FUME|20260318091500||ADT^A01|msg-0001|P|2.5\nEVN|A01|20260318091500\nPID|1||rec-5001^^^EXCARE^MR||Reed^Avery||19900612|F\nPV1|1|O|||||||||||||||||enc-1001^^^EXCARE^VN",
"MSH|^~\\&|EXCARE|EXCARE-CLINIC|FUME|FUME|20260318093000||ADT^A01|msg-0002|P|2.5\nEVN|A01|20260318093000\nPID|1||rec-5002^^^EXCARE^MR||Taylor^Jordan||19881103|M\nPV1|1|O|||||||||||||||||enc-1002^^^EXCARE^VN"
]
}
Expression: parse one message
$v2json(messages[0])
Result
{
"MSH": {
"SegmentDescription": "Message Header",
"MessageLine": 1,
"FieldSeparator": "|",
"EncodingCharacters": "^~\\&",
"SendingApplication": {
"NamespaceID": "EXCARE"
},
"SendingFacility": {
"NamespaceID": "EXCARE-CLINIC"
},
"ReceivingApplication": {
"NamespaceID": "FUME"
},
"ReceivingFacility": {
"NamespaceID": "FUME"
},
"DateTimeOfMessage": {
"Time": "2026-03-18T09:15:00"
},
"MessageType": {
"MessageCode": "ADT",
"TriggerEvent": "A01"
},
"MessageControlID": "msg-0001",
"ProcessingID": {
"ProcessingID": "P"
},
"VersionID": {
"VersionID": "2.5"
}
},
"EVN": {
"SegmentDescription": "Event Type",
"MessageLine": 2,
"EventTypeCode": "A01",
"RecordedDateTime": {
"Time": "2026-03-18T09:15:00"
}
},
"PID": {
"SegmentDescription": "Patient Identification",
"MessageLine": 3,
"SetID": "1",
"PatientIdentifierList": {
"IDNumber": "rec-5001",
"AssigningAuthority": {
"NamespaceID": "EXCARE"
},
"IdentifierTypeCode": "MR"
},
"PatientName": {
"FamilyName": {
"Surname": "Reed"
},
"GivenName": "Avery"
},
"DateTimeOfBirth": {
"Time": "1990-06-12"
},
"AdministrativeSex": "F"
},
"PV1": {
"SegmentDescription": "Patient Visit",
"MessageLine": 4,
"SetID": "1",
"PatientClass": "O",
"VisitNumber": {
"IDNumber": "enc-1001",
"AssigningAuthority": {
"NamespaceID": "EXCARE"
},
"IdentifierTypeCode": "VN"
}
}
}
Expression: parse every message in the array
messages.$v2json($)
Result
The result below is abbreviated to keep the example readable.
[
{
"MSH": {
"MessageControlID": "msg-0001"
},
"PID": {
"PatientIdentifierList": {
"IDNumber": "rec-5001"
},
"PatientName": {
"FamilyName": {
"Surname": "Reed"
},
"GivenName": "Avery"
}
},
"PV1": {
"VisitNumber": {
"IDNumber": "enc-1001"
}
}
},
{
"MSH": {
"MessageControlID": "msg-0002"
},
"PID": {
"PatientIdentifierList": {
"IDNumber": "rec-5002"
},
"PatientName": {
"FamilyName": {
"Surname": "Taylor"
},
"GivenName": "Jordan"
}
},
"PV1": {
"VisitNumber": {
"IDNumber": "enc-1002"
}
}
}
]