diff --git a/CHANGELOG.md b/CHANGELOG.md index edeb6de..6968d3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +## [v0.3.0] - 2023-10-13 + +### Added + +Docs: Add more jsonb encoding format descriptions. (#34) +Feat: Support `object_each` api. (#33) +Feat: Support `path_exists` api. (#32) +Feat: Support `type_of` api. (#31) +Feat: Support `strip_nulls` api. (#30) +Perf: Add benches for parser and `get_path`. (#29) +Chore: Add check fmt and clippy. (#27) +Feat: Support `to_pretty_string` api. (#26) +Feat: Support `traverse_check_string` function. (#25) +Feat: Improve json path selector using less memory. (#24) + ## [v0.2.3] - 2023-07-10 ### Fixed diff --git a/Cargo.toml b/Cargo.toml index a69debc..c51371a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,24 +22,24 @@ keywords = ["json", "jsonb", "jsonpath"] license = "Apache-2.0" name = "jsonb" repository = "https://github.com/datafuselabs/jsonb" -version = "0.2.3" +version = "0.3.0" rust-version = "1.68" [dependencies] -byteorder = "1.4.3" +byteorder = "1.5.0" fast-float = "0.2.0" nom = "7.1.3" -ordered-float = { version = "3.6.0", default-features = false } +ordered-float = { version = "4.1.1", default-features = false } rand = { version = "0.8.5", features = ["small_rng"] } -serde_json = { version = "1.0.95", default-features = false, features = [ +serde_json = { version = "1.0.107", default-features = false, features = [ "preserve_order", ] } [dev-dependencies] goldenfile = "1.5.2" -serde_json = "1.0.105" +serde_json = "1.0.107" json-deserializer = "0.4.4" -simd-json = {version = "0.10.6", features = ["allow-non-simd"]} +simd-json = {version = "0.11.1", features = ["allow-non-simd"]} mockalloc = "0.1.2" criterion = "0.5.1" diff --git a/src/functions.rs b/src/functions.rs index 254f0e1..12e19a5 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -1054,7 +1054,12 @@ pub fn is_object(value: &[u8]) -> bool { /// Convert `JSONB` value to String pub fn to_string(value: &[u8]) -> String { if !is_jsonb(value) { - return String::from_utf8_lossy(value).to_string(); + // empty value as default null + if value.is_empty() { + return "null".to_string(); + } else { + return String::from_utf8_lossy(value).to_string(); + } } let mut json = String::new(); @@ -1065,7 +1070,12 @@ pub fn to_string(value: &[u8]) -> String { /// Convert `JSONB` value to pretty String pub fn to_pretty_string(value: &[u8]) -> String { if !is_jsonb(value) { - return String::from_utf8_lossy(value).to_string(); + // empty value as default null + if value.is_empty() { + return "null".to_string(); + } else { + return String::from_utf8_lossy(value).to_string(); + } } let mut json = String::new();