How can I parse || as null values to be injected as null or '' in my JSON object?
For example:
when i parse hl7 message like :
PID|1|99999911^^^MRN^MRN^""|51685^^^Community Medical Record Number^CMRN^""~99999911^^^MRN^MRN^""|
JSON Object will be :
'pid': {
'set_id_patient_id': {
'si': {
'si': '1'
}
},
'patient_id_external_id': {
'id': {
'st': '99999911'
},
'assigning_authority': {
'namespace_id': 'MRN'
},
'identifier_type_code': {
'is': 'MRN'
},
'assigning_facility': {
'namespace_id': '""'
}
}
}
But if the hl7 message becomes:
PID||99999911^^^MRN^MRN^""|51685^^^Community Medical Record Number^CMRN^""~99999911^^^MRN^MRN^""|
How can I parse || as null values to be injected as null or '' in my JSON object? For example: when i parse hl7 message like : PID|1|99999911^^^MRN^MRN^""|51685^^^Community Medical Record Number^CMRN^""~99999911^^^MRN^MRN^""| JSON Object will be : 'pid': { 'set_id_patient_id': { 'si': { 'si': '1' } }, 'patient_id_external_id': { 'id': { 'st': '99999911' }, 'assigning_authority': { 'namespace_id': 'MRN' }, 'identifier_type_code': { 'is': 'MRN' }, 'assigning_facility': { 'namespace_id': '""' } } }
But if the hl7 message becomes: PID||99999911^^^MRN^MRN^""|51685^^^Community Medical Record Number^CMRN^""~99999911^^^MRN^MRN^""|
the JSON Object will be : 'pid': { 'patient_id_external_id': { 'id': { 'st': '99999911' }, 'assigning_authority': { 'namespace_id': 'MRN' }, 'identifier_type_code': { 'is': 'MRN' }, 'assigning_facility': { 'namespace_id': '""' } } }
in this case i can't find the property : set_id_patient_id in my JSON Object
How can I get this property even if it's not found as a field in the HL7 Message?