Skip to content

Commit

Permalink
Parse .jsonproto files as JSON5
Browse files Browse the repository at this point in the history
This lets us use advanced features like comments and trailing commas!
  • Loading branch information
akonradi-signal authored Jun 26, 2024
1 parent 3fe5fdd commit b502388
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 1 deletion.
134 changes: 134 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions converter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ clap = { version = "4.2.1", features = ["derive"] }
clap-stdin = "0.3.0"
displaydoc = "0.2.4"
futures = "0.3.29"
json5 = "0.4.1"
protobuf = "3.3.0"
protobuf-json-mapping = "3.3.0"
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion converter/src/bin/json_to_binproto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn main() {
eprintln!("reading from {:?}", filename.source);

let contents =
serde_json::from_str(&String::from_utf8(read_file(filename)).expect("not a string"))
json5::from_str(&String::from_utf8(read_file(filename)).expect("not a string"))
.expect("invalid JSON");

let contents = assert_matches!(contents, serde_json::Value::Array(contents) => contents);
Expand Down
1 change: 1 addition & 0 deletions test-cases/account-data.jsonproto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Minimal backup file that includes only an account data frame.
[
{
"version": "1",
Expand Down

0 comments on commit b502388

Please sign in to comment.