diff --git a/lib/fhir_models/bootstrap/json.rb b/lib/fhir_models/bootstrap/json.rb index d156b26a..7a72cf0b 100644 --- a/lib/fhir_models/bootstrap/json.rb +++ b/lib/fhir_models/bootstrap/json.rb @@ -7,7 +7,7 @@ module Json # def to_json - JSON.pretty_unparse(to_hash) + JSON.pretty_generate(to_hash) end def self.from_json(json, namespace = FHIR) diff --git a/lib/fhir_models/bootstrap/preprocess.rb b/lib/fhir_models/bootstrap/preprocess.rb index 9939ec5b..8c599192 100644 --- a/lib/fhir_models/bootstrap/preprocess.rb +++ b/lib/fhir_models/bootstrap/preprocess.rb @@ -26,7 +26,7 @@ def self.pre_process_bundle(filename) # Output the post processed file f = File.open(filename, 'w:UTF-8') - f.write(JSON.pretty_unparse(hash)) + f.write(JSON.pretty_generate(hash)) f.close finish = File.size(filename) puts " Removed #{(start - finish) / 1024} KB" if start != finish @@ -131,7 +131,7 @@ def self.pre_process_json_example(filename) # Output the post processed file f = File.open(filename, 'w:UTF-8') - f.write(JSON.pretty_unparse(hash)) + f.write(JSON.pretty_generate(hash)) f.close finish = File.size(filename) puts " Removed #{(start - finish) / 1024} KB" if start != finish diff --git a/lib/fhir_models/fhir_ext/structure_definition_finding.rb b/lib/fhir_models/fhir_ext/structure_definition_finding.rb index 9dbaf0c2..e256e8b3 100644 --- a/lib/fhir_models/fhir_ext/structure_definition_finding.rb +++ b/lib/fhir_models/fhir_ext/structure_definition_finding.rb @@ -16,7 +16,7 @@ def to_s end def to_json - JSON.pretty_unparse(as_json) + JSON.pretty_generate(as_json) end def from_json(json) diff --git a/lib/fhir_models/tasks/tasks.rake b/lib/fhir_models/tasks/tasks.rake index 42f28346..d2e4ca24 100644 --- a/lib/fhir_models/tasks/tasks.rake +++ b/lib/fhir_models/tasks/tasks.rake @@ -316,7 +316,7 @@ namespace :fhir do # Output the post processed file f = File.open(filename, 'w:UTF-8') - f.write(JSON.pretty_unparse(hash)) + f.write(JSON.pretty_generate(hash)) f.close finish = File.size(filename) puts " Removed #{(start - finish) / 1024} KB" if start != finish diff --git a/test/unit/json_validation_test.rb b/test/unit/json_validation_test.rb index dbecc602..337b7d89 100644 --- a/test/unit/json_validation_test.rb +++ b/test/unit/json_validation_test.rb @@ -24,7 +24,7 @@ def run_json_validation_test(example_file, example_name) resource = FHIR::Json.from_json(input_json) errors = resource.validate unless errors.empty? - File.open("#{ERROR_DIR}/#{example_name}.err", 'w:UTF-8') { |file| file.write(JSON.pretty_unparse(errors)) } + File.open("#{ERROR_DIR}/#{example_name}.err", 'w:UTF-8') { |file| file.write(JSON.pretty_generate(errors)) } File.open("#{ERROR_DIR}/#{example_name}.json", 'w:UTF-8') { |file| file.write(input_json) } end assert errors.empty?, "Resource failed to validate: #{errors}" diff --git a/test/unit/xml_validation_test.rb b/test/unit/xml_validation_test.rb index e2928d97..b542f688 100644 --- a/test/unit/xml_validation_test.rb +++ b/test/unit/xml_validation_test.rb @@ -24,7 +24,7 @@ def run_xml_validation_test(example_file, example_name) resource = FHIR::Xml.from_xml(input_xml) errors = resource.validate unless errors.empty? - File.open("#{ERROR_DIR}/#{example_name}.err", 'w:UTF-8') { |file| file.write(JSON.pretty_unparse(errors)) } + File.open("#{ERROR_DIR}/#{example_name}.err", 'w:UTF-8') { |file| file.write(JSON.pretty_generate(errors)) } File.open("#{ERROR_DIR}/#{example_name}.xml", 'w:UTF-8') { |file| file.write(input_xml) } end assert errors.empty?, 'Resource failed to validate.'