File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 3
3
Type: module
4
4
Options: [delay]
5
5
Exports: [to-json load-json]
6
- Version: 0.1.0
6
+ Version: 0.1.1
7
7
Title: "JSON codec"
8
8
Purpose: "Convert Rebol value into JSON format and back."
9
9
File: https://raw.githubusercontent.com/Oldes/Rebol3/master/src/mezz/codec-json.reb
@@ -27,6 +27,7 @@ Rebol [
27
27
0.0.3 31-Aug-2018 "Gabriele" "Converted to non-recursive version"
28
28
0.0.4 9-Oct-2018 "Gabriele" "Back to an easier to read recursive version"
29
29
0.1.0 13-Feb-2020 "Oldes" "Ported Red's version back to Rebol"
30
+ 0.1.1 22-Dec-2021 "Oldes" "Handle '+1' and/or '-1' JSON keys"
30
31
]
31
32
32
33
Rights: "Copyright (C) 2019 Red Foundation. All rights reserved."
@@ -233,7 +234,15 @@ json-object: [
233
234
]
234
235
235
236
property-list: [property any [sep property]]
236
- property: [json-name (emit either parse _str [word-1st any word-char] [to word! _str] [_str]) json-value]
237
+ property: [
238
+ json-name (
239
+ emit either parse _str [
240
+ and [word-1st any word-char]
241
+ not [#"+" | #"-" ] some digit end ; do not try to convert +1 or -1 to words
242
+ ] [to word! _str] [_str]
243
+ )
244
+ json-value
245
+ ]
237
246
json-name: [ws* string-literal ws* #":" ]
238
247
239
248
;-----------------------------------------------------------
Original file line number Diff line number Diff line change @@ -399,6 +399,8 @@ if find codecs 'JSON [
399
399
data: # (a: 1 b: # (c: 2.0 ) d: "^/^- " )
400
400
str: encode 'JSON data
401
401
--assert data = decode 'JSON str
402
+ ; Github is using "+1" and "-1" keys in the `reactions` data now
403
+ --assert ["+1" 1 ] = to block! decode 'JSON {{"+1": 1} }
402
404
===end-group===
403
405
]
404
406
You can’t perform that action at this time.
0 commit comments