How to use HS.JSON.Path
Has anyone used the ##class(HS.JSON.Path).%Evaluate() classmethod interrogate JSON and return a specific object value? I need to extract the MessageHeader.destination.endpoint value from a FHIR bundle and can't seem to get that XPath-like method to work.
Discussion (2)2
Comments
HS.JSON.Path is intended for use with dynamic objects. With a dynamic object it'd look like (for example):
SAMPLE>set obj = {"destination":{"endpoint":"foo"}}
SAMPLE>w ##class(HS.JSON.Path).%Evaluate(obj,"$.destination.endpoint").%Get(0)
fooAlso, this should probably be a question rather than an announcement.
Thanks! Yes indeed - a question vs announcement - not sure how that got changed (?). But thanks - I think that's my issue - I have a stream vs an object as 1st parameter.
Thanks again!