Commit Graph

84 Commits

Author SHA1 Message Date
Jeroen van Rijn 601df0e8f7 Port tests\core\encoding\json 2024-06-02 14:47:08 -04:00
IllusionMan1212 65a4a56a83 fix(core/encoding/json): remove Unsupported_Type return when marshalling bit_set 2024-05-25 00:45:30 +02:00
korvahkh 9b759f39fc encoding/json: Properly marshal #no_nil unions
Previously the first variant of a `#no_nil` would always be output as
`null`, and following variants would be treated as the wrong type.
2024-05-11 14:36:56 -05: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 92a5666c1c Json: fields on structs like 'using _: T' will now have T's fields
marshalled directly into the parent type without an '"_":{ ... }'.
This seems like desirable behavior to me, since you can't access the
fields with 'Parent_Type._.field' either.
2024-03-26 20:22:51 +01:00
gingerBill c05a92ab3e Merge pull request #3215 from blob1807/json-better-enum-support
core:encoding/json Add support for writing enum value names
2024-03-06 14:56:19 +00:00
gingerBill 8d496dc3d0 Fix #3173 2024-03-06 14:51:56 +00:00
gingerBill 5eef29290c Fix #3250 2024-03-06 11:49:17 +00:00
blob1807 b419615002 Apply suggestions from code review
Fixing spelling mistakes pointed out & fixed by layton.

Co-authored-by: Laytan <laytanlaats@hotmail.com>
2024-03-04 21:20:13 +10:00
blob1807 116edb9052 convert spaces to tabs 2024-03-04 15:09:17 +10:00
blob1807 9070e613a4 Return underlining value instead of panicing
when no name it found.

Renamed use_enum_value_names to use_enum_names
it get the same point across & inline with the
reflect procs
2024-03-04 15:06:30 +10:00
blob1807 41fbaaf1d3 changed to use reflect.enum_name_from_value_any 2024-03-01 14:53:39 +10:00
blob1807 f14babe419 Merge branch 'odin-lang:master' into json-better-enum-support 2024-03-01 14:24:51 +10:00
gingerBill a4b8c1ea17 Begin work adding bit_field 2024-02-22 15:55:54 +00:00
blob1807 a95cead8e7 add all inter types to switch 2024-02-21 14:05:50 +10:00
blob1807 c276b1c0bc replace spaces with tabs 2024-02-21 11:51:29 +10:00
blob1807 b39ef29ec6 add missing comma 2024-02-21 11:15:35 +10:00
blob1807 b2b8b14955 Add better support for Enums in json
Can now output enum value's name instead of its underlineing value
2024-02-21 11:07:03 +10:00
blob1807 7e0473dded Revert json union fix 2024-02-21 11:03:15 +10:00
blob1807 14ee2181cb Fix bug https://github.com/odin-lang/Odin/issues/3173 2024-02-21 00:42:11 +10:00
gingerBill 3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
Karl Zylinski 9d067ae562 Made sure temp guard for sorting map keys in json marshal code ignores temp allocator 2024-01-22 14:35:05 +01:00
Karl Zylinski 942e91f94c Added temp allocator guard to json.marshal, in case we temp alloc when sorting map kesy 2023-11-01 00:46:01 +01:00
Karl Zylinski d8f06ed557 Reversed order of sort_maps_by_key check in marshal.odin to make PR comparison clearer. 2023-11-01 00:37:27 +01:00
Karl Zylinski a73ff00b02 Indentation fix. 2023-11-01 00:33:59 +01:00
Karl Zylinski a58a08c0c3 JSON: Option to sort marshaled maps before outputting. Also added a json.clone_value proc 2023-11-01 00:23:17 +01:00
gingerBill 14adcb9db8 Use or_break and or_continue where appropriate in the core library 2023-09-30 15:34:39 +01:00
RLGingerBiscuit 187a475b84 json.marshal: Don't output spaces if pretty=false 2023-08-25 17:33:41 +01:00
gingerBill c91898a888 Remove #relative slices; Replace with #relative multi-pointers 2023-08-05 16:05:39 +01:00
Laytan Laats 5d54b710e7 fix #2550 json encoding should use surrogate pairs per RFC7159 2023-05-22 17:22:33 +02:00
Ikko Eltociear Ashimine 47be46ae60 Fix typo in marshal.odin
seperation -> separation
2023-04-27 00:03:36 +09:00
gingerBill 6179d4feb1 Rename to Type_Info_Parameters 2023-02-08 11:23:21 +00:00
gingerBill 450a602230 Fix json.marshal for map[string]string 2023-01-24 12:05:43 +00:00
gingerBill 6a4e44607c Fix json marshal for maps 2022-11-08 14:59:09 +00:00
gingerBill 6dd4d1a924 Correct reflection usage of maps 2022-11-08 11:50:55 +00:00
gingerBill 1e595f2e26 Add missing import 2022-09-14 18:27:02 +01:00
gingerBill 28ad4f8623 Use json field tag for json.marshal 2022-09-14 18:21:12 +01:00
Despacito696969 ecfea027a0 Fixed marshal_to_writer not supporting i128
Previously json.marshal(i128(696969)) would print 0 as there was no `u = i128(i)` initialization.
2022-08-26 23:49:33 +02:00
Michael Kutowski b739044e69 Update marshal.odin 2022-08-12 13:59:11 +02:00
Michael Kutowski 9e0107c9fc add new soa type, my bad wasnt on master 2022-08-12 13:50:19 +02:00
Michael Kutowski 107e016508 switch styling and opt.spaces max 2022-08-12 13:42:19 +02:00
gingerBill 57b20e634b Merge branch 'master' into pretty-json-2 2022-08-11 16:14:27 +01:00
Michael Kutowski 425dec8bb8 add uint as hex option 2022-08-08 18:28:28 +02:00
gingerBill 5e3cf45df3 Add #soa pointer type to aid with refactoring to #soa data types
a: #soa[16]Foo
p := &a[6]
#assert(type_of(p) == #soa^#soa[16]Foo)
p^.x = 123
p.x = 123
2022-08-08 15:07:00 +01:00
Michael Kutowski 53e0d182af ...bad paste 2022-08-05 18:56:14 +02:00
Michael Kutowski a6fa41e290 marshal output options with pretty option and other config 2022-08-05 18:53:29 +02:00