smarter_json 0.6.0

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.
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SmarterJSON
4
+ VERSION = "0.6.0"
5
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SmarterJSON
4
+ # A non-fatal thing the parser worked around while staying lenient — e.g. an empty
5
+ # comma slot it collapsed, a key with no value it read as null, or a duplicate key
6
+ # it dropped. Surfaced only when process / process_file is called with warnings: true
7
+ # (which then returns [result, warnings]); otherwise the parser stays silent.
8
+ #
9
+ # type — a Symbol you can branch on (:empty_slot, :empty_value, :duplicate_key)
10
+ # message — human-readable description
11
+ # line/col — where it happened in the input
12
+ Warning = Struct.new(:type, :message, :line, :col) do
13
+ def to_s
14
+ line ? "#{message} at line #{line}, col #{col}" : message
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,25 @@
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/warning" # SmarterJSON::Warning value object (the warnings: option)
8
+ require_relative "smarter_json/parser"
9
+ require_relative "smarter_json/generator"
10
+
11
+ # Optional C extension. When compiled and loadable it defines SmarterJSON.parse_c;
12
+ # otherwise we run pure Ruby. (Mirrors smarter_csv's load-with-rescue pattern.)
13
+ begin
14
+ require_relative "smarter_json/smarter_json"
15
+ rescue LoadError
16
+ # pure-Ruby fallback — no acceleration available
17
+ end
18
+
19
+ module SmarterJSON
20
+ HAS_ACCELERATION = respond_to?(:parse_c)
21
+
22
+ # parse_c is internal — the public API is process / process_file / generate.
23
+ # (rb_funcall from C and the internal `process` dispatch still reach it.)
24
+ private_class_method :parse_c if HAS_ACCELERATION
25
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smarter_json
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
+ platform: ruby
6
+ authors:
7
+ - Tilo Sloboda
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2026-06-02 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
+ - lib/smarter_json/warning.rb
60
+ homepage: https://github.com/tilo/smarter_json
61
+ licenses:
62
+ - MIT
63
+ metadata:
64
+ homepage_uri: https://github.com/tilo/smarter_json
65
+ source_code_uri: https://github.com/tilo/smarter_json/tree/main
66
+ changelog_uri: https://github.com/tilo/smarter_json/blob/main/CHANGELOG.md
67
+ documentation_uri: https://github.com/tilo/smarter_json#readme
68
+ bug_tracker_uri: https://github.com/tilo/smarter_json/issues
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 2.6.0
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubygems_version: 4.0.11
84
+ specification_version: 4
85
+ summary: 'SmarterJSON: A lenient, robust, streaming JSON parser for Ruby supporting
86
+ JSON, JSON5, NDJSON, and HJSON-style input.'
87
+ test_files: []