private static JObject getContentsAsJObject(Resource resource, bool summary)
        {
            JsonDomFhirWriter writer = new JsonDomFhirWriter();
            ResourceWriter    w      = new ResourceWriter(writer);

            w.Serialize(resource, summary);

            return(writer.Result);
        }
Esempio n. 2
0
 // [WMR 20180409] NEW
 // https://github.com/ewoutkramer/fhir-net-api/issues/545
 public JObject SerializeToDocument(Base instance, SummaryType summary = SummaryType.False)
 {
     return(jsonWriterToDocument(jw =>
     {
         using (var writer = new JsonDomFhirWriter(jw))
         {
             Serialize(instance, writer, summary, null);
             jw.Flush();
         }
     }));
 }
Esempio n. 3
0
 public static byte[] SerializeToJsonBytes(Base instance, SummaryType summary = SummaryType.False, string root = null)
 {
     // [WMR 20160421] Explicit disposal
     // return jsonWriterToBytes(jw => Serialize(instance, new JsonDomFhirWriter(jw), summary, root));
     return(jsonWriterToBytes(jw => {
         using (var writer = new JsonDomFhirWriter(jw))
         {
             Serialize(instance, writer, summary, root);
             jw.Flush();
         }
     }));
 }
Esempio n. 4
0
 public string SerializeToString(Base instance, SummaryType summary = SummaryType.False)
 {
     // [WMR 20160421] Explicit disposal
     // return jsonWriterToString(jw => Serialize(instance, new JsonDomFhirWriter(jw), summary));
     return(jsonWriterToString(jw =>
     {
         using (var writer = new JsonDomFhirWriter(jw))
         {
             Serialize(instance, writer, summary, null);
             jw.Flush();
         }
     }));
 }
        private static JObject getContentsAsJObject(Resource resource, bool summary)
        {
            JsonDomFhirWriter writer = new JsonDomFhirWriter();
            ResourceWriter w = new ResourceWriter(writer);
            w.Serialize(resource, summary);

            return writer.Result;
        }