Stream: implementers
Topic: Is there a way to encode JSON as reference objects?
Jake (Oct 18 2018 at 16:03):
When encoding from Java to JSON using the Hapi JSON Encoder (http://hapifhir.io/apidocs/ca/uhn/fhir/parser/JsonParser.html), I would like to encode the JSON as references to objects rather than have the object be filled out for each element. I don't see a way to do this in the IParser javadocs, is this a missing feature or am I missing something?
Example of what I mean
{
"container" : [ {
"provider" : {
"reference" : {
"value" : "MyObject/1"
}
}
}
}, {
"MyObject" : {
"id" : {
"id" : "1"
},
// Data filled out for org
Lloyd McKenzie (Oct 18 2018 at 22:02):
Not really clear on what you're asking for here. You can't change the syntax of the JSON without becoming non-conformant to the FHIR spec - and HAPI certainly isn't going to change to support such a deviation.
Grahame Grieve (Oct 18 2018 at 22:41):
I think that the java objects have a holder element so you can put the resolved object reference on the object once it's resolved, but resolving the references is outside the scope of a parser
Last updated: Apr 12 2022 at 19:14 UTC