Ihor Andrianov
b8b0f860d7
clippy
2025-02-10 15:34:47 +02:00
Ihor Andrianov
aad0522f56
refactor to make parser more readable
2025-02-10 15:13:36 +02:00
Ihor Andrianov
a10955cbcf
refine quoted key handling, add RawString option for SQLite compat
2025-02-10 15:12:07 +02:00
Ihor Andrianov
ee16c49c6c
add support for quoted path
2025-02-10 15:09:27 +02:00
Ihor Andrianov
f84a6b878a
fixed edge cases and add some tests, remove pest grammar
2025-02-10 15:09:26 +02:00
Ihor Andrianov
166532cc81
simplify json path parsing
2025-02-10 15:09:23 +02:00
l.gualtieri
3487969c40
fix floating point numbers get truncated in json #877
2025-02-10 12:23:43 +01:00
pedrocarlo
41360075ba
cargo clippy
2025-02-10 00:59:20 -03:00
pedrocarlo
fe453ecfc5
remove RC<String> requirement for build_text and new text
2025-02-09 13:44:39 -03:00
pedrocarlo
c3cad5dfdd
corrected to use newly created as_str function to convert to string slice
2025-02-07 00:07:51 -03:00
pedrocarlo
c8bb1fd353
unreachable to agg and record types, as it should not be possible to pass them to json_quote
2025-02-06 23:43:30 -03:00
pedrocarlo
b678375c69
increasing string capacity to reduce allocations
2025-02-06 23:37:30 -03:00
pedrocarlo
90ecaf40b5
removed unnecessary string allocations for escaped json value
2025-02-06 23:37:30 -03:00
pedrocarlo
303a687e65
rebase to main
2025-02-06 23:35:58 -03:00
Pekka Enberg
f9828e0e6f
core: Parse UTF-8 strings lazily
2025-02-06 13:27:52 +02:00
Pekka Enberg
0d318d810e
core: Add Text::from_str() helper
2025-02-05 20:02:57 +02:00
Pekka Enberg
5abf49a0be
core: Rename LimboText to Text
2025-02-05 20:02:27 +02:00
Marcus Nilsson
01492cf46f
add support for json_set
...
Test cases are included.
Related to #127
2025-02-04 19:09:58 +01:00
Marcus Nilsson
3478352b18
move extraction of JsonPath from OwnedValue to separate function
2025-02-04 17:49:49 +01:00
Pekka Enberg
31552f0862
core/json: Kill some unwrap() calls
2025-02-04 14:55:19 +02:00
pedrocarlo
2e115d948d
implement json_pretty
2025-02-01 23:04:46 -03:00
Ihor Andrianov
d968b314ed
fix bug for 1 arg
2025-01-30 03:44:33 +02:00
Ihor Andrianov
ee52192cd8
add unit tests
2025-01-30 03:13:58 +02:00
Ihor Andrianov
ccf51cae80
moved is_json_valid above tests
2025-01-30 02:47:11 +02:00
Ihor Andrianov
5cf80d8cef
cargo clippy
2025-01-30 02:40:35 +02:00
Ihor Andrianov
52eab0544a
add Target discrete type to handle array and obj changes
2025-01-30 02:09:01 +02:00
Ihor Andrianov
30d810bfe5
add utility function to get mut ref by path
2025-01-30 00:05:53 +02:00
Ihor Andrianov
305e86ec39
allow path parser accept numbers as keys
2025-01-29 22:39:35 +02:00
Ihor Andrianov
d57d9bef6f
add function definition
2025-01-29 22:37:04 +02:00
Pekka Enberg
06edf33878
Merge 'json_patch() function implementation' from Ihor Andrianov
...
First review #820
The function follows RFC 7386 JSON Merge Patch semantics:
* If the patch is null, the target is replaced with null
* If the patch contains a scalar value, the target is replaced with that
value
* If both target and patch are objects, the patch is recursively applied
* null values in the patch result in property removal from the target
Closes #821
2025-01-29 19:54:12 +02:00
Pekka Enberg
db72756d2a
Merge 'Changes to json serialization/deserialization' from Ihor Andrianov
...
Change JSON deserialization to enable json_patch implementation with
SQLite-compatible behavior:
* Preserves duplicate keys in JSON objects
* Applies patches only to the first occurrence of each key
* Trade-off: Changes key lookup from O(1) to O(n) to support duplicate
keys
* Have to be merged before json_patch() function
Closes #820
2025-01-29 19:53:41 +02:00
Pekka Enberg
4af6eb2f71
Merge 'Refactor Json serialization to accommodate formatters for pretty printing' from Pedro Muniz
...
Json serialization logic was pulled from serde_json. Google's json5
serialization code was not flexible enough to allow for pretty printing
json, so I believe that the formatter design is a good layer to abstract
this logic. This refactor will trivially enable the implementation of
json_pretty function from sqlite. My other PR for json_quote, #763 ,
depends a tiny bit on a helper utility from the previous serialization
implementation. If this PR is considered first, I will change the code
in my other PR to account for this.
Reviewed-by: Diego Reis (@diegoreis42)
Reviewed-by: Kacper Madej (@madejejej)
Closes #771
2025-01-29 19:03:14 +02:00
Ihor Andrianov
0048f77b45
add unit tests
2025-01-29 18:05:41 +02:00
Ihor Andrianov
4e7c4e7ced
fixes to pass tests
2025-01-29 18:05:41 +02:00
Ihor Andrianov
2407a29e90
refactored into patcher struct and made code more modular and readable
2025-01-29 18:05:40 +02:00
Ihor Andrianov
f164dbdb1e
fix case where first patched value applied wins
2025-01-29 18:05:40 +02:00
Ihor Andrianov
6a605939e6
naming refine
2025-01-29 18:05:39 +02:00
Ihor Andrianov
846a73188a
add json_patch implementation
2025-01-29 18:05:39 +02:00
Ihor Andrianov
5c55615896
add Removed enum type to discard removed fields on parsing stage
2025-01-29 17:59:48 +02:00
Ihor Andrianov
f97d085934
add deserialization patch to represent obj as ordered Vec and preserve duplicates
2025-01-29 17:59:48 +02:00
pedrocarlo
01626f9355
cleanup of some TODOs
2025-01-27 12:23:59 -03:00
pedrocarlo
75e78a6c70
cargo clippy
2025-01-27 12:20:13 -03:00
Harin
0903b9b019
Implemented JSON valid function
2025-01-26 23:35:47 +05:30
pedrocarlo
f77eacd90f
cargo fmt
2025-01-23 03:31:01 -03:00
pedrocarlo
946d431d96
refactor of json serialization using formatters as is in serde_json
2025-01-23 03:26:05 -03:00
Pekka Enberg
bda1e4e6ab
Merge 'Add support for json_object
function' from Jorge Hermo
...
Relates to #127 . This PR is still in draft and I have a few left things
to do (tests, improve implementation), just opening it so anyone can
track this work meanwhile.
Closes #664
2025-01-20 09:36:56 +02:00
Jorge López
3da7d8cb79
syntactic changes: Markdown semantics
2025-01-18 19:20:11 +01:00
Jorge López
bbe3cded38
syntactic changes: use f64::INFINITY instead of deprecated std::f64::INFINITY
2025-01-18 19:20:11 +01:00
Jorge López
218a2e6dda
syntactic changes: remove unneeded mut, lifetimes,references that get instantaneously dereferenced and casts
2025-01-18 18:43:47 +01:00
Jorge López
86a4714711
syntactic changes: remove unneeded paths when the type is already imported
2025-01-18 18:29:12 +01:00