-1

I have downloaded schema from FHIR site and i had used xsd2java for converting to POJO's. It is working fine iam using jackson library to create a json and sending request to FHIR server. when iam using JSON's provide in FHIR site its says incompatible.

Thanks

Ravz1234
  • 129
  • 1
  • 2
  • 12
  • I think you need to add rather a lot more detail than just this – Grahame Grieve Aug 26 '14 at 21:07
  • Hi Grahame, Json's we are creating JSON's out of Jackson or Gson are working with our FHIR implementation. where as if i take the JSON from FHIR site it says incompatble. Below is the sample of our JSON and FHIR JSON for observation.(Was keeping only one parameter ast the json is huge) JSON for Jackson:-(Working) { "reliability": { "value":"ok"}} } JSON from FHIR site:-(Not Working) { "reliability": "ok" } – Ravz1234 Aug 27 '14 at 05:55
  • I still have no idea what you are doing. I think: using XML, generating code from the schema, you generate content that conforms to the schemas. I don't see what this has to do with Jackson, since that is a json library. Your answer is even more confusing, since { "reliability": "ok" } is correct (I think you refer to Observation.reliability) – Grahame Grieve Aug 27 '14 at 09:31
  • Hi, "Observation" class has 'reliability' property of type "ObservationReliablity". And "ObservationReliablity" class has 'value' property of type Enum ObservationReliabilityList, when we generate JSON it will be something like { "reliability": { "value":"ok"}}. It will not be like { "reliability": "ok" }. Or iam missing something – Ravz1234 Aug 27 '14 at 19:11
  • I suggest you read the JSON page in the specification carefully – Grahame Grieve Aug 27 '14 at 22:32
  • So... whats your question? – Vality Aug 27 '14 at 23:22

1 Answers1

0

Trying to use the XSDs to codegen some POJOs might possibly be able to work, but it's about the most painful way you could possibly approach the problem.

There are two very good Java implementations of FHIR out there (disclosure: I helped write one) both of which provide a much more elegant solution to this problem, and support both XML and JSON out of the box.

Have a look at the reference implementation as well as HAPI-FHIR.

James Agnew
  • 701
  • 4
  • 3
  • Hi Graheme, in this link Mcenzie has updated what to do, in disqus forum, http://hl7.org/implement/standards/fhir/json.html. It is more for aligning the JSON and xml. – Ravz1234 Aug 28 '14 at 04:55
  • @james Do you have any recommendations for how to choose which library to use? I think all we will want to use are the domain objects and the marshalling/unmarshalling code. Both seem to have those features. – jjathman Oct 10 '14 at 18:43
  • Of the two, the RI is probably a bit more bleeding edge (I believe a build already exists which supports the latest FHIR dev, where HAPI supports DSTU1 only at the moment) but HAPI has more documentation, as well as having a server framework built in. We are hoping to align these two frameworks more closely in the future (if not downright merge them) so hopefully the differences will matter less in the future. – James Agnew Oct 15 '14 at 16:06