json 1.8.3-java → 1.8.5-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of json might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/json/ext/generator.jar +0 -0
- data/lib/json/ext/parser.jar +0 -0
- data/lib/json/pure/generator.rb +10 -2
- data/lib/json/version.rb +1 -1
- data/tests/test_json.rb +0 -34
- data/tests/test_json_generate.rb +11 -0
- metadata +34 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 220ac0461bacfc9f8c43a48c6a167cd8d3dfea7e
|
4
|
+
data.tar.gz: 221775a3c15d8972d4e724a0c541f85a0ffd5102
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2932d989adf5cc35e70b662cff2af267fe2fbb6ad5bce8929ba8c763cf35d15eb48d2d509322c1f1fa8ca76b96f9a00091c09a77c5d5e4ce2dfb66433ac5cd8
|
7
|
+
data.tar.gz: 558bbf908ecd5d08e22247659ebedb39e74b99077aef75533afa92e17f86c669eff97db9a5c9308fa1e7dc0ed3892ddae5c7b410b7b35c80e84615b9b9fdc606
|
data/lib/json/ext/generator.jar
CHANGED
Binary file
|
data/lib/json/ext/parser.jar
CHANGED
Binary file
|
data/lib/json/pure/generator.rb
CHANGED
@@ -363,7 +363,11 @@ module JSON
|
|
363
363
|
result << state.space_before
|
364
364
|
result << ':'
|
365
365
|
result << state.space
|
366
|
-
|
366
|
+
if value.respond_to?(:to_json)
|
367
|
+
result << value.to_json(state)
|
368
|
+
else
|
369
|
+
result << %{"#{String(value)}"}
|
370
|
+
end
|
367
371
|
first = false
|
368
372
|
}
|
369
373
|
depth = state.depth -= 1
|
@@ -398,7 +402,11 @@ module JSON
|
|
398
402
|
each { |value|
|
399
403
|
result << delim unless first
|
400
404
|
result << state.indent * depth if indent
|
401
|
-
|
405
|
+
if value.respond_to?(:to_json)
|
406
|
+
result << value.to_json(state)
|
407
|
+
else
|
408
|
+
result << %{"#{String(value)}"}
|
409
|
+
end
|
402
410
|
first = false
|
403
411
|
}
|
404
412
|
depth = state.depth -= 1
|
data/lib/json/version.rb
CHANGED
data/tests/test_json.rb
CHANGED
@@ -7,20 +7,6 @@ require 'stringio'
|
|
7
7
|
require 'tempfile'
|
8
8
|
require 'ostruct'
|
9
9
|
|
10
|
-
unless Array.method_defined?(:permutation)
|
11
|
-
begin
|
12
|
-
require 'enumerator'
|
13
|
-
require 'permutation'
|
14
|
-
class Array
|
15
|
-
def permutation
|
16
|
-
Permutation.for(self).to_enum.map { |x| x.project }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
rescue LoadError
|
20
|
-
warn "Skipping permutation tests."
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
10
|
class TestJSON < Test::Unit::TestCase
|
25
11
|
include JSON
|
26
12
|
|
@@ -146,26 +132,6 @@ class TestJSON < Test::Unit::TestCase
|
|
146
132
|
assert_raise(JSON::ParserError) { JSON.parse('[ 1, ]', :quirks_mode => true) }
|
147
133
|
end
|
148
134
|
|
149
|
-
if Array.method_defined?(:permutation)
|
150
|
-
def test_parse_more_complex_arrays
|
151
|
-
a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
|
152
|
-
a.permutation.each do |perm|
|
153
|
-
json = pretty_generate(perm)
|
154
|
-
assert_equal perm, parse(json)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
def test_parse_complex_objects
|
159
|
-
a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
|
160
|
-
a.permutation.each do |perm|
|
161
|
-
s = "a"
|
162
|
-
orig_obj = perm.inject({}) { |h, x| h[s.dup] = x; s = s.succ; h }
|
163
|
-
json = pretty_generate(orig_obj)
|
164
|
-
assert_equal orig_obj, parse(json)
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
135
|
def test_parse_arrays
|
170
136
|
assert_equal([1,2,3], parse('[1,2,3]'))
|
171
137
|
assert_equal([1.2,2,3], parse('[1.2,2,3]'))
|
data/tests/test_json_generate.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
|
+
# frozen_string_literal: false
|
3
4
|
|
4
5
|
require 'test/unit'
|
5
6
|
require File.join(File.dirname(__FILE__), 'setup_variant')
|
@@ -334,4 +335,14 @@ EOT
|
|
334
335
|
assert_equal true, JSON.generate(["\xea"])
|
335
336
|
end
|
336
337
|
end
|
338
|
+
|
339
|
+
def test_string_subclass
|
340
|
+
s = Class.new(String) do
|
341
|
+
def to_s; self; end
|
342
|
+
undef to_json
|
343
|
+
end
|
344
|
+
assert_nothing_raised(SystemStackError) do
|
345
|
+
assert_equal '["foo"]', JSON.generate([s.new('foo')])
|
346
|
+
end
|
347
|
+
end
|
337
348
|
end
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.5
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Daniel Luz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2017-01-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '0'
|
19
|
+
name: rake
|
20
|
+
prerelease: false
|
21
|
+
type: :development
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
33
|
+
name: test-unit
|
34
|
+
prerelease: false
|
35
|
+
type: :development
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
13
41
|
description: A JSON implementation as a JRuby extension.
|
14
42
|
email: dev+ruby@mernen.com
|
15
43
|
executables: []
|
@@ -89,17 +117,17 @@ require_paths:
|
|
89
117
|
- lib
|
90
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
119
|
requirements:
|
92
|
-
- -
|
120
|
+
- - ">="
|
93
121
|
- !ruby/object:Gem::Version
|
94
122
|
version: '0'
|
95
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
124
|
requirements:
|
97
|
-
- -
|
125
|
+
- - ">="
|
98
126
|
- !ruby/object:Gem::Version
|
99
127
|
version: '0'
|
100
128
|
requirements: []
|
101
129
|
rubyforge_project: json-jruby
|
102
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.6.8
|
103
131
|
signing_key:
|
104
132
|
specification_version: 4
|
105
133
|
summary: JSON implementation for JRuby
|