Skip to content

Commit 03738aa

Browse files
committed
up crate
1 parent 8962c23 commit 03738aa

File tree

3 files changed

+156
-15
lines changed

3 files changed

+156
-15
lines changed

Cargo.lock

Lines changed: 153 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ crate-type = ["cdylib"]
1111
[dependencies]
1212
anyhow = "1.0.98"
1313
ijson = "0.1.4"
14-
json_comments = "0.2.2"
1514
pyo3 = { version = "0.24.0", features = ["anyhow"] }
1615
serde = "1.0.219"
1716
serde_json = "1.0.140"
17+
serde_json5 = "0.2.1"

src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
use anyhow::{ Context, Result };
22

3-
use json_comments::StripComments;
43
use pyo3::{ prelude::*, types::{ PyBool, PyDict, PyFloat, PyInt, PyList, PyNone, PyString } };
54
use ijson::{ IValue, ValueType };
65

76
#[pyfunction]
87
fn loads_str(py: Python<'_>, json: &str) -> Result<Py<PyAny>> {
9-
let reader = StripComments::new(json.as_bytes());
10-
let value: IValue = serde_json::from_reader(reader).context("ijson::IValue extraction")?;
11-
8+
let value: IValue = serde_json::from_str(json).context("ijson::IValue extraction")?;
129
Ok(get_py(py, value)?)
1310
}
1411

1512
#[pyfunction]
1613
fn loads_bytes(py: Python<'_>, json: &[u8]) -> Result<Py<PyAny>> {
17-
let reader = StripComments::new(json);
18-
let value: IValue = serde_json::from_reader(reader).context("ijson::IValue extraction")?;
19-
14+
let value: IValue = serde_json5::from_slice(json).context("ijson::IValue extraction")?;
2015
Ok(get_py(py, value)?)
2116
}
2217

0 commit comments

Comments
 (0)