From abfcb93904e79b14ac975300f89a726c4dbe2c9c Mon Sep 17 00:00:00 2001 From: Jon Roes Date: Fri, 26 Apr 2013 21:45:53 -0400 Subject: [PATCH] use oj for json encoding --- lib/export/json_encoder.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/export/json_encoder.rb b/lib/export/json_encoder.rb index ae41e519208..bc2e945b501 100644 --- a/lib/export/json_encoder.rb +++ b/lib/export/json_encoder.rb @@ -2,9 +2,6 @@ module Export class SchemaArgumentsError < RuntimeError; end - # TODO: Use yajl-ruby for performance. - # https://github.com/brianmario/yajl-ruby - class JsonEncoder def initialize @@ -58,7 +55,8 @@ module Export def finish @schema_data[:schema][:table_count] = @table_data.keys.count - json_output_stream.write( @schema_data.merge(@table_data).to_json ) + json_output_stream.write( Oj.dump(@schema_data.merge(@table_data), + :mode => :compat) ) json_output_stream.close @filenames = [File.join( tmp_directory, 'tables.json' )] @@ -72,4 +70,4 @@ module Export FileUtils.rm_rf(tmp_directory) if Dir[tmp_directory].present? end end -end \ No newline at end of file +end