alamb commented on code in PR #7782:
URL: https://github.com/apache/arrow-rs/pull/7782#discussion_r2167682961
##########
parquet-variant/src/to_json.rs:
##########
@@ -103,23 +105,34 @@ fn write_decimal_i64(
///
/// # Examples
///
+///
/// ```rust
/// # use parquet_variant::{Variant, variant_to_json};
/// # use arrow_schema::ArrowError;
-/// let variant = Variant::Int32(42);
+/// let variant = Variant::String("Hello, World!");
/// let mut buffer = Vec::new();
/// variant_to_json(&mut buffer, &variant)?;
-/// assert_eq!(String::from_utf8(buffer).unwrap(), "42");
+/// assert_eq!(String::from_utf8(buffer).unwrap(), "\"Hello, World!\"");
/// # Ok::<(), ArrowError>(())
/// ```
///
+/// # Example: Create a [`Variant::Object`] and convert to JSON
/// ```rust
-/// # use parquet_variant::{Variant, variant_to_json};
+/// # use parquet_variant::{Variant, VariantBuilder, variant_to_json};
/// # use arrow_schema::ArrowError;
-/// let variant = Variant::String("Hello, World!");
-/// let mut buffer = Vec::new();
-/// variant_to_json(&mut buffer, &variant)?;
-/// assert_eq!(String::from_utf8(buffer).unwrap(), "\"Hello, World!\"");
+/// let mut builder = VariantBuilder::new();
Review Comment:
The nested object is a great example and I wanted to have that again on
variant_to_json as well
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]