changed CHANGELOG.md
 
@@ -1,5 1,9 @@
1
1
# Changelog
2
2
3
## 1.4.4 (26.07.2024)
4
5
* Fix warnings on Elixir 1.17 by conditionally compiling Decimal support
6
3
7
## 1.4.3 (29.06.2024)
4
8
5
9
* Fix derive with _ struct key
changed hex_metadata.config
 
@@ -1,6 1,6 @@
1
1
{<<"links">>,[{<<"GitHub">>,<<"https://github.com/michalmuskala/jason">>}]}.
2
2
{<<"name">>,<<"jason">>}.
3
- {<<"version">>,<<"1.4.3">>}.
3
{<<"version">>,<<"1.4.4">>}.
4
4
{<<"description">>,
5
5
<<"A blazing fast JSON parser and generator in pure Elixir.">>}.
6
6
{<<"elixir">>,<<"~> 1.4">>}.
changed lib/decoder.ex
 
@@ -86,17 86,21 @@ defmodule Jason.Decoder do
86
86
end
87
87
end
88
88
89
- defp float_decode_function(%{floats: :decimals}) do
90
- fn string, token, skip ->
91
- # silence xref warning
92
- decimal = Decimal
93
- try do
94
- decimal.new(string)
95
- rescue
96
- Decimal.Error ->
97
- token_error(token, skip)
89
if Code.ensure_loaded?(Decimal) do
90
defp float_decode_function(%{floats: :decimals}) do
91
fn string, token, skip ->
92
try do
93
Decimal.new(string)
94
rescue
95
Decimal.Error ->
96
token_error(token, skip)
97
end
98
98
end
99
99
end
100
else
101
defp float_decode_function(%{floats: :decimals}) do
102
raise ArgumentError, "decimal library not found, :decimals option not available"
103
end
100
104
end
101
105
102
106
defp value(data, original, skip, stack, decode) do
changed lib/encode.ex
 
@@ -236,10 236,10 @@ defmodule Jason.Encode do
236
236
end
237
237
end
238
238
239
- defp struct(value, _escape, _encode_map, Decimal) do
240
- # silence the xref warning
241
- decimal = Decimal
242
- [?", decimal.to_string(value, :normal), ?"]
239
if Code.ensure_loaded?(Decimal) do
240
defp struct(value, _escape, _encode_map, Decimal) do
241
[?", Decimal.to_string(value, :normal), ?"]
242
end
243
243
end
244
244
245
245
defp struct(value, escape, encode_map, Fragment) do
changed lib/encoder.ex
 
@@ -224,11 224,11 @@ defimpl Jason.Encoder, for: [Date, Time, NaiveDateTime, DateTime] do
224
224
end
225
225
end
226
226
227
- defimpl Jason.Encoder, for: Decimal do
228
- def encode(value, _opts) do
229
- # silence the xref warning
230
- decimal = Decimal
231
- [?", decimal.to_string(value), ?"]
227
if Code.ensure_loaded?(Decimal) do
228
defimpl Jason.Encoder, for: Decimal do
229
def encode(value, _opts) do
230
[?", Decimal.to_string(value), ?"]
231
end
232
232
end
233
233
end
changed mix.exs
 
@@ -2,7 2,7 @@ defmodule Jason.Mixfile do
2
2
use Mix.Project
3
3
4
4
@source_url "https://github.com/michalmuskala/jason"
5
- @version "1.4.3"
5
@version "1.4.4"
6
6
7
7
def project() do
8
8
[