smarter_json 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +46 -0
- data/CHANGELOG.md +70 -0
- data/LICENSE.txt +21 -0
- data/README.md +110 -0
- data/Rakefile +22 -0
- data/docs/_introduction.md +48 -0
- data/docs/basic_read_api.md +72 -0
- data/docs/basic_write_api.md +91 -0
- data/docs/examples.md +140 -0
- data/docs/options.md +58 -0
- data/ext/smarter_json/extconf.rb +30 -0
- data/ext/smarter_json/smarter_json.c +1424 -0
- data/ext/smarter_json/smarter_json.h +9 -0
- data/ext/smarter_json/vendor/ryu.h +819 -0
- data/ext/smarter_json/vendor/ryu.md +22 -0
- data/lib/smarter_json/errors.rb +28 -0
- data/lib/smarter_json/generator.rb +117 -0
- data/lib/smarter_json/parser.rb +926 -0
- data/lib/smarter_json/version.rb +5 -0
- data/lib/smarter_json.rb +24 -0
- metadata +86 -0
data/lib/smarter_json.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bigdecimal" # for bigdecimal_load: :auto / :bigdecimal (Oj-compatible)
|
|
4
|
+
|
|
5
|
+
require_relative "smarter_json/version"
|
|
6
|
+
require_relative "smarter_json/errors" # base Error + subclasses — must load before parser/generator
|
|
7
|
+
require_relative "smarter_json/parser"
|
|
8
|
+
require_relative "smarter_json/generator"
|
|
9
|
+
|
|
10
|
+
# Optional C extension. When compiled and loadable it defines SmarterJSON.parse_c;
|
|
11
|
+
# otherwise we run pure Ruby. (Mirrors smarter_csv's load-with-rescue pattern.)
|
|
12
|
+
begin
|
|
13
|
+
require_relative "smarter_json/smarter_json"
|
|
14
|
+
rescue LoadError
|
|
15
|
+
# pure-Ruby fallback — no acceleration available
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
module SmarterJSON
|
|
19
|
+
HAS_ACCELERATION = respond_to?(:parse_c)
|
|
20
|
+
|
|
21
|
+
# parse_c is internal — the public API is process / process_file / generate.
|
|
22
|
+
# (rb_funcall from C and the internal `process` dispatch still reach it.)
|
|
23
|
+
private_class_method :parse_c if HAS_ACCELERATION
|
|
24
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: smarter_json
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.5.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Tilo Sloboda
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-06-01 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: bigdecimal
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
26
|
+
description: 'SmarterJSON is a permissive JSON/JSON5 parser: comments, trailing commas,
|
|
27
|
+
different quote styles, Python/JS keywords, and more, all parse to the same Ruby
|
|
28
|
+
objects. Purposely no strict mode, always best-effort, blazing fast. Handles BOM,
|
|
29
|
+
smart quotes, messy input. Compatible with config/data files and API responses alike.
|
|
30
|
+
|
|
31
|
+
'
|
|
32
|
+
email:
|
|
33
|
+
- tilo.sloboda@gmail.com
|
|
34
|
+
executables: []
|
|
35
|
+
extensions:
|
|
36
|
+
- ext/smarter_json/extconf.rb
|
|
37
|
+
extra_rdoc_files: []
|
|
38
|
+
files:
|
|
39
|
+
- ".gitignore"
|
|
40
|
+
- CHANGELOG.md
|
|
41
|
+
- LICENSE.txt
|
|
42
|
+
- README.md
|
|
43
|
+
- Rakefile
|
|
44
|
+
- docs/_introduction.md
|
|
45
|
+
- docs/basic_read_api.md
|
|
46
|
+
- docs/basic_write_api.md
|
|
47
|
+
- docs/examples.md
|
|
48
|
+
- docs/options.md
|
|
49
|
+
- ext/smarter_json/extconf.rb
|
|
50
|
+
- ext/smarter_json/smarter_json.c
|
|
51
|
+
- ext/smarter_json/smarter_json.h
|
|
52
|
+
- ext/smarter_json/vendor/ryu.h
|
|
53
|
+
- ext/smarter_json/vendor/ryu.md
|
|
54
|
+
- lib/smarter_json.rb
|
|
55
|
+
- lib/smarter_json/errors.rb
|
|
56
|
+
- lib/smarter_json/generator.rb
|
|
57
|
+
- lib/smarter_json/parser.rb
|
|
58
|
+
- lib/smarter_json/version.rb
|
|
59
|
+
homepage: https://github.com/tilo/smarter_json
|
|
60
|
+
licenses:
|
|
61
|
+
- MIT
|
|
62
|
+
metadata:
|
|
63
|
+
homepage_uri: https://github.com/tilo/smarter_json
|
|
64
|
+
source_code_uri: https://github.com/tilo/smarter_json/tree/main
|
|
65
|
+
changelog_uri: https://github.com/tilo/smarter_json/blob/main/CHANGELOG.md
|
|
66
|
+
documentation_uri: https://github.com/tilo/smarter_json#readme
|
|
67
|
+
bug_tracker_uri: https://github.com/tilo/smarter_json/issues
|
|
68
|
+
rdoc_options: []
|
|
69
|
+
require_paths:
|
|
70
|
+
- lib
|
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 2.6.0
|
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - ">="
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: '0'
|
|
81
|
+
requirements: []
|
|
82
|
+
rubygems_version: 4.0.11
|
|
83
|
+
specification_version: 4
|
|
84
|
+
summary: 'SmarterJSON: A lenient, robust, streaming JSON parser for Ruby supporting
|
|
85
|
+
JSON, JSON5, NDJSON, and HJSON-style input.'
|
|
86
|
+
test_files: []
|