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
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
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
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
004cd4933d
Merge branch 'master' of https://github.com/blob1807/Odin
2024-02-21 00:43:27 +10:00
blob1807
14ee2181cb
Fix bug https://github.com/odin-lang/Odin/issues/3173
2024-02-21 00:42:11 +10: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
98b539ac5c
Merge pull request #2912 from karl-zylinski/marshal-sort-maps-by-key-and-clone-value
...
JSON: Option to sort marshaled maps before outputting + clone_value proc + small improvements
2024-01-22 14:05:15 +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
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
Karl Zylinski
75cb2c68cc
Cleanup of json.clone_value
2023-11-01 00:57:27 +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
Rickard Andersson
931e0d4687
cleanup: remove unused import
2023-10-02 15:21:09 +03:00
Rickard Andersson
cfa3765d50
fix: guard against empty key value in parse_object_body
2023-10-02 15:10:12 +03:00
Rickard Andersson
11e884aec5
docs: add note about checking for alloc error
2023-10-02 12:20:18 +03:00
Rickard Andersson
55a1ba710b
fix: use runtime.map_insert to not overallocate
2023-10-02 11:59:37 +03:00
Rickard Andersson
0a8b266c71
fix(json): return .Out_Of_Memory when out of memory on parse
...
Previously this would silently simply not do anything and the object
would be empty/incomplete when parsed instead.
2023-10-02 11:50:16 +03:00
gingerBill
14adcb9db8
Use or_break and or_continue where appropriate in the core library
2023-09-30 15:34:39 +01:00
Abdelrahman Farid
f1872f495a
Fix bug with index increment in unquote_string
2023-09-19 22:19:05 +03: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
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
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
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
Karl Zylinski
d7cc166eab
Fix for skip_alphanum in JSON tokenizer not checking if first character is non-alphanum. This broke any single-character key when using SJSON specification in combination with not using quoted strings.
2023-04-05 22:37:05 +02:00
Jeroen van Rijn
1e4a4181e2
Typo
2023-03-25 07:37:43 +01:00