Permalink
Browse files

use multi_json instead of json

  • Loading branch information...
1 parent c2e45db commit 51c8ae0b0ece951cf31f1017827ed380fa2379f7 @mkristian committed Feb 28, 2013
View
@@ -1,4 +1,4 @@
properties['jruby.versions']='1.5.6,1.6.8,1.7.2'
properties['jruby.18and19']='true'
-properties['jruby.plugins.version']='0.29.3'
+properties['jruby.plugins.version']='0.29.4'
properties['jruby.version']='1.7.2'
View
@@ -23,5 +23,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'copyright-header', '~> 1.0.7'
s.add_development_dependency 'minitest', '~> 4.3'
s.add_development_dependency 'virtus', '~> 0.5.0'
- s.add_development_dependency 'json', '~> 1.7'
+ s.add_development_dependency 'multi_json', '~> 1.6'
end
@@ -18,6 +18,7 @@
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
+require 'multi_json'
module Ixtlan
module Babel
class Deserializer
@@ -74,7 +75,7 @@ def from_hash(data, options = nil)
end
def from_json(json, options = nil)
- data = JSON.parse(json)
+ data = MultiJson.load(json)
from_hash(data, options)
end
@@ -84,4 +85,4 @@ def from_yaml(yaml, options = nil)
end
end
end
-end
+end
@@ -18,6 +18,7 @@
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
+require 'multi_json'
require 'ixtlan/babel/hash_filter'
require 'ixtlan/babel/model_filter'
require 'ixtlan/babel/filter_config'
@@ -156,4 +157,4 @@ def filter_model( model )
end
end
end
-end
+end
@@ -61,7 +61,7 @@ def children_ages
it 'should serialize and deserialize with methods' do
json = serializer.to_json(:include => [:age, :children_names, :children_ages])
- data = JSON.parse(json)
+ data = MultiJson.load(json)
data['age'].must_equal 123
data['children_names'].must_equal ['anna', 'jack', 'rama', 'mia']
data['children_ages'].must_equal [12, 3, 6, 9]
@@ -86,7 +86,7 @@ def children_ages
it 'should serialize and deserialize a hash with include list' do
json = serializer.to_json(:include => ['address', 'phone_numbers'])
- data = JSON.parse(json)
+ data = MultiJson.load(json)
data['phone_numbers'][0]['prefix'].must_equal 12
data['phone_numbers'][0]['number'].must_equal '123'
result = deserializer.from_json(json, :include => ['address', 'phone_numbers'])

0 comments on commit 51c8ae0

Please sign in to comment.