Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement json_pretty #860

Merged
merged 1 commit into from
Feb 4, 2025
Merged

Conversation

pedrocarlo
Copy link
Contributor

This PR implements json_pretty. At the moment, support for jsonb is being added, so this function suffers from the same limitations as in json(x). Also, I have not found a way to implement the same conversion of Blob -> String that SQLite does. From my own experimentation, I believe SQLite converts blobs to a lossy ascii representation, but I would appreciate some help on this.

@@ -41,7 +42,10 @@ pub fn get_json(json_value: &OwnedValue) -> crate::Result<OwnedValue> {
}

let json_val = get_json_value(json_value)?;
let json = to_string(&json_val).unwrap();
let json = match indent {
Some(indent) => to_string_pretty(&json_val, indent).unwrap(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? instead of unwrap?

@penberg penberg merged commit 2d9a54c into tursodatabase:main Feb 4, 2025
27 checks passed
@pedrocarlo pedrocarlo deleted the feature/json_pretty branch February 4, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants