Commit Graph

53 Commits

Author SHA1 Message Date
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
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
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
dozn 87c159c69f Remove unnecessary string() conversion. 2024-12-28 08:13:38 -08:00
dozn d22cb20d85 Use Struct Tags For Embedded (with using) Structs When Unmarshalling JSON
A fix for https://github.com/odin-lang/Odin/issues/4539
2024-12-28 07:48:09 -08:00
Laytan Laats 7edd332993 fix #4536 - stack buffer overflow for size_of 0 types in struct unmarshal 2024-12-06 22:12:52 +01:00
dozn 37fb2754a1 Move Struct Field Zipping Outside of JSON Token Loop 2024-12-05 07:23:34 -08:00
o:tone c3478e0002 fix unmarshal unhandled error (#4515)
* fix unmarshal unhandled error
2024-11-25 13:15:33 +01:00
gingerBill 26f6741674 Check for more errors in json.unmarshal 2024-11-14 16:45:36 +00:00
Laytan Laats e79f94ca5e encoding/json: fix leak when string is unmarshalled into non-string field
Fixes #4391
2024-10-19 17:08:24 +02:00
jakubtomsu 7487d507be unmarshal bitset ints like cbor does 2024-09-04 11:08:45 +02:00
Jeroen van Rijn fc5ce30f34 Allow json to unmarshal empty struct. 2024-07-21 00:37:11 +02:00
gingerBill 02408b713a Merge pull request #3910 from VladPavliuk/json-add-int-key-map-support
Allow to `marshal` and `unmarshal` maps with int keys
2024-07-14 22:00:01 +01:00
gingerBill 399c3ab067 Reduce the size of runtime.Type_Info 2024-07-14 21:37:35 +01:00
VladPavliuk dbdad0476d Allow to marshal and unmarshal maps with int keys 2024-07-13 00:07:48 +03:00
Feoramund 309a770cbf Fix omitempty in json.marshal 2024-04-27 05:24:59 -04:00
gingerBill 334e08c750 Update numerous package declaration names 2024-04-18 12:17:39 +01:00
gingerBill fd487f66bc Add json:"name,omitempty" 2024-04-10 13:40:25 +01:00
gingerBill d0dc7395e9 Allow for comma-separate json names json:"name,flag" 2024-04-10 13:29:10 +01:00
Laytan Laats 3a0df80066 correct newly found vets 2024-04-03 00:52:58 +02:00
Franz Höltermann a422aba578 Json: improved unmarshalling of using _: T fields.
`using _: T` fields will now have their members unmarshalled to their
parent types reflecting the new behaviour of json.marshall.

Example:
```go
A :: struct {
    using _: B,
}

B :: struct {
    field: string,
}

data := `{"field": "Hello World"}`

a: A
json.unmarshal_string(data, &a)
```
2024-03-27 15:46:44 +01:00
gingerBill 6d3a57b4ac Zero intrinsics.alloca 2024-03-06 13:48:37 +00:00
gingerBill c7b8f1fb0a Use intrinsics.alloca rather than context.temp_allocator in json.unmarshal_object 2024-03-06 13:42:38 +00:00
gingerBill 5eef29290c Fix #3250 2024-03-06 11:49:17 +00:00
Kay 5f49b8997a remove return statement from case Type_Info_Enumerated_Array, as it causes early exit in JSON unmarshalling. 2024-02-12 01:45:11 -06:00
gingerBill 3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
gingerBill 0b83e3dae5 Enforce naming the parameters with builtin.quaternion to reduce confusion 2024-01-05 14:29:14 +00:00
Laytan Laats 8c10f4cdde encoding/json: try to unmarshal into union variants 2024-01-03 19:02:30 +01:00
gingerBill 3dec55f009 Replace x in &y Use &v in y syntax through core & vendor for switch/for statements 2023-06-26 15:42:57 +01:00
jakubtomsu a6d5f9877f Convert indentation to tabs 2023-04-14 17:27:52 +02:00
jakubtomsu 994825671d Handle unmarshalling to json.Value 2023-04-14 15:05:25 +02:00
gingerBill 986cba584e Add runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD where appropriate 2023-02-10 16:23:33 +00:00
gingerBill 04a1e7d638 Correct json/unmarshal.odin 2022-11-11 16:15:21 +00:00
gingerBill 6dd4d1a924 Correct reflection usage of maps 2022-11-08 11:50:55 +00:00
Michael Kutowski f65bdf5733 else statement to allow skipping unused struct fields 2022-09-30 19:40:41 +02:00
gingerBill a6d3cbe824 Correct json.unmarshal for maps 2022-09-21 13:10:06 +01:00
gingerBill 40bcfc7c8d Update json/unmarshal.odin for the new runtime.__dynamic_map_set 2022-09-17 13:05:14 +01:00
gingerBill db1b7b2d21 Allow for ignored fields in struct for json.unmarshal 2022-09-14 16:52:01 +01:00
William Roe d913155972 Fix bug unmarshalling JSON with assertions disabled
When asserts are disabled, code within the assert isn't run. Having
expect_token within an assert means that the state of the Parser is
mutated when asserts are run, but not when they aren't.

There's already a wrapper procedure for this pattern, which I have
reused here.
2022-07-28 13:56:14 +01:00
gingerBill 3ec70c5517 Merge functionality of #maybe with the standard 'union' functionality 2022-05-23 12:04:19 +01:00
Phil H a7138b22a5 Fix 'unmarsal' typo 2021-12-05 19:04:14 -08:00
gingerBill a75dc9d86d Fix minor issue with unmarshal for booleans 2021-11-13 19:07:16 +00:00
gingerBill 19ac822e4a Improve reflect.Type_Info_Complex support 2021-09-29 15:08:45 +01:00
gingerBill 9d797ea225 Add more support for complex types 2021-09-29 15:02:51 +01:00
gingerBill c22f2866c7 Remove fmt dependency 2021-09-29 13:18:06 +01:00
gingerBill 9bc12e3f38 Improve json.marshal error handling for io.Writer; Add docs for the different JSON specifications 2021-09-29 13:06:03 +01:00
gingerBill d452758afc Improve MJSON handling 2021-09-28 15:01:11 +01:00
gingerBill c933054872 Support json.Specification.MJSON
https://bitsquid.blogspot.com/2009/10/simplified-json-notation.html
2021-09-28 14:53:16 +01:00