Commit Graph
401 Commits
Author SHA1 Message Date
Jeroen van Rijn b6ea6f7a12 Merge pull request #5882 from IllusionMan1212/custom-json-marshalling
encoding/json: custom json (un)marshalling
2026-01-01 16:07:01 +00:00
dozn 8fea2b783c [encoding/json] Allow Unmarshalling to rune
Fixes https://github.com/odin-lang/Odin/issues/6061
2025-12-30 18:10:07 -08:00
dozn 589dbbddd2 [encoding/json] Fix Escapes When Marshalling
Fixes https://github.com/odin-lang/Odin/issues/6060 and https://github.com/odin-lang/Odin/issues/6075
The boolean "true" was setting `html_safe` instead of `for_json`.
Chalk one up for the "use enums instead of booleans" crowd.
2025-12-30 17:02:06 -08:00
dozn affaefc13a Moved first_iteration up a couple lines so it makes sense readability-wise. 2025-12-30 04:42:06 -08:00
dozn ba68d75c6f Add JSON5/SJSON Comments When Marshalling
Allows user-facing JSON5/SJSON to have comments explaining field usage.
`json.Marshal_Options.pretty` must be enabled since we only use single-line comments (not to mention it wouldn't be terribly useful without `pretty` set anyways).
We don't escape anything, so `\n` will display as "\n", but you're still able to enter in a proper newline character and it'll be displayed on multiple lines.
2025-12-29 12:23:54 -08:00
Laytan 852ea91cdb Merge pull request #6078 from BigBoyBarney/json-arrays
Fix standard json parsing / unmarshalling issue for pure arrays
2025-12-29 15:53:51 +01:00
Sylphrena 6441fc09e0 Fix standard json parsing / unmarshalling issue for pure arrays 2025-12-29 15:35:34 +01:00
Zoltán Kéri d802a4e9fa encoding/base32: Fix padding validation for malformed input
Fix a bug where padding characters in the middle of input were
not detected when there was no trailing padding.

The "verify no padding in middle" check was inside `if
padding_count > 0`, so inputs like "MZ===YTBMZXW6YTB" would
incorrectly pass validation.

Test case added for this edge case.
2025-12-27 04:30:37 +01:00
StudebakerGuy ab74b8283d Address issue identifying of CDATA
The XML library wasn't identifying CDATA and skipping over it.
This was found when CDATA contained a <. This patch addresses
that issue.
2025-12-23 09:35:09 -05:00
Jeroen van Rijn 83fb7ba952 Make custom JSON (un)marshalers more like core:fmt's 2025-12-10 17:54:12 +01:00
Hisham Aburaqibah 72d65603eb encoding/json: error handling for custom (un)marshallers 2025-12-02 22:46:35 +02:00
IllusionMan1212 4b9e15786d encoding/json: custom json (un)marshalling 2025-12-02 22:46:31 +02:00
Franz Hoeltermann cd4bec0007 Increase base64 decoding table size to 256, preventing out of bounds reads 2025-11-22 12:54:36 +01:00
Neirokan 8cdf7ade48 encoding/json: clone unquoted strings 2025-11-06 19:24:58 +03:00
gingerBill e5153a937b Merge pull request #5859 from odin-lang/bill/change-license
Change Odin's LICENSE to zlib from BSD 3-clause
2025-11-04 13:53:13 +00:00
Laytan 9893a0eaea encoding/cbor: fix epoch tag with small values 2025-11-03 20:33:17 +01:00
gingerBill 842cfee0f3 Change Odin's LICENSE to zlib from BSD 3-clause
This change was made in order to allow things produced with Odin and using Odin's core library, to not require the LICENSE to also be distributed alongside the binary form.
2025-10-28 14:38:25 +00:00
Jeroen van Rijn 236111864e Link doc lines to source specifications. 2025-10-10 18:29:52 +02:00
Jeroen van Rijn ece213afca Render examples. 2025-10-10 12:24:28 +02:00
Jeroen van Rijn 7a9ea3ee6d Further overhaul of package line comments. 2025-10-09 23:05:29 +02:00
Jeroen van Rijn 288b45f50c package lines for encoding 2025-10-09 16:34:18 +02:00
Jeroen van Rijn 248b0fe9e1 More package lines 2025-10-09 16:11:33 +02:00
Jeroen van Rijn aec7d6480b Package lines for base32, move its tests to tests" 2025-10-09 15:27:53 +02:00
Courtney Strachan 69ad94d8a8 Followup fix to #4895 2025-10-05 19:22:04 -07:00
Courtney Strachan 6de2d6e8ca Merge branch 'odin-lang:master' into master 2025-10-06 02:41:44 +01:00
gingerBill d3b8770318 Add #+test to base32_test.odin 2025-09-28 20:48:13 +01:00
gingerBill 7642e0a0e0 Require @(init) and @(fini) to be proc "contextless" () 2025-08-08 12:10:01 +01:00
gingerBill af3184adc9 Change is_utf16 field to encoding and use an enum 2025-08-05 15:12:54 +01:00
gingerBill ae02d3d02d Begin supporting string16 across the core library 2025-08-02 11:55:16 +01:00
Jeroen van Rijn 179e5b8835 Fix #4705
Allocate `doc.tokenizer`, and free it in `destroy`.
2025-06-09 15:09:04 +02:00
Feoramund b7de15caa3 Clarify strconv.append_* to strconv.write_* 2025-06-05 16:56:00 -04:00
Laytan Laats 9eefa2006e encoding/cbor: support simd vectors 2025-06-04 22:00:02 +02:00
Laytan Laats 85224b21e6 encoding/cbor: support the matrix type 2025-06-04 21:51:12 +02:00
Wesley Kerfoot cac18b4aba Fix incorrect CSV reader settings for example, fix typo in docs 2025-05-27 14:27:22 -04:00
Feoramund a9df1b1cde Rename core:encoding/ansi to core:terminal/ansi 2025-05-20 19:28:06 -04:00
Laytan d3159f74cd Merge pull request #4944 from dozn/master
[core:encoding/json] When Unmarshalling, Only Match On Struct Tags If Present
2025-05-15 22:31:34 +02:00
Barinzaya 3f5e09a0df Fixed an overflow when decoding a large CBOR slice.
The initial allocation for the slice is limited to prevent untrusted
data from forcing a huge allocation, but then the dynamic array was
created with a capacity of the unlimited length, rather than the actual
capacity of the allocation. This was causing a buffer overrun.
2025-04-29 08:19:43 -04:00
Jeroen van Rijn 4f00224dd2 Add cbor.unmarshal_from_bytes taking a []byte 2025-04-29 01:10:15 +02:00
Ely Alon 13566306d2 Fix typo in private function 2025-04-28 22:03:20 +03:00
Jeroen van Rijn ab5ca087a7 Add comment 2025-04-19 23:44:02 +02:00
Jeroen van Rijn 062a3c2fae Fix parsing of CDATA tags (#5059)
Fixes #5054
2025-04-19 20:25:44 +02:00
Jeroen van Rijn 3287e1b0f0 Fix HXA defer warning 2025-04-07 13:19:00 +02:00
Jeroen van Rijn f7c4c80ef3 Fix broken examples in documentation tester.
No more:
```
We could not find the procedure "pkg_foo_example :: proc()" needed to test the example created for "pkg.foo"
The following procedures were found:
   bar()
```
2025-04-05 16:36:26 +02:00
Laytan Laats e4bc9677af fix unmarshalling bit sets in json
Fixes #4761
2025-03-22 00:20:00 +01:00
dozn 3148acf6a6 [core:encoding/json] When Unmarshalling, Only Match Struct Tags If Present 2025-03-17 01:51:04 -07:00
Courtney Strachan dbbe96ae5c Fixed json null value parsing 2025-03-02 07:57:23 -08:00
jkenda 51b80c5a20 encoding/json: marshal enumerated arrays to objects with key-value pairs 2025-02-01 10:32:07 +01:00
Jeroen van Rijn 600e0ebed0 Fix stray space vs. tab 2025-01-12 12:13:29 +01:00
gingerBill c7739de891 Merge pull request #4634 from dozn/patch-1
Use Struct Tags For Embedded (with `using`) Structs When Unmarshalling JSON
2025-01-06 09:33:42 +00:00
Zoltán Kéri a4a1562905 encoding/base32: Add @(rodata) attribute to default tables
Add `@(rodata)` attribute to `ENC_TABLE` and `DEC_TABLE` to mark
them as read-only data. This places these tables in the read-only
section of the executable, protecting them from modification
during program execution.
2025-01-03 19:16:56 +01:00