Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Fixed syntax highlighting in `README.md`
  • Loading branch information
CGMossa authored and PureWhiteWu committed Oct 18, 2023
1 parent c48a707 commit ebf7d8a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ citm_catalog/serde_json::to_string
```

### Get from JSON
` cargo bench --bench get_from -- --quiet`
`cargo bench --bench get_from -- --quiet`

```
twitter/sonic-rs::get_from_str
Expand All @@ -166,7 +166,7 @@ twitter/gjson::get time: [344.41 µs 351.36 µs 362.03 µs]

Directly use the `Deserialize` or `Serialize` trait, recommended use `sonic_rs::{Deserialize, Serialize}`.

```
```rs
use sonic_rs::{Deserialize, Serialize};
// or use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -197,7 +197,7 @@ fn main() {

Get a specific field from a JSON with the `pointer` path. The return is a `LazyValue`, which is a wrapper of a raw JSON slice. Note that the JSON must be valid and well-formed, otherwise it may return unexpected result.

```
```rs
use sonic_rs::{get_from_str, pointer, JsonValue, PointerNode};

fn main() {
Expand All @@ -223,7 +223,7 @@ fn main() {

Parse a JSON as a document, and the document is mutable.

```
```rs
use sonic_rs::value::{dom_from_slice, Value};
use sonic_rs::PointerNode;
use sonic_rs::{pointer, JsonValue};
Expand Down Expand Up @@ -263,14 +263,13 @@ fn main() {
obj.insert("inserted", value);
assert!(obj.contains_key("inserted"));
}
```

### JSON Iterator

Parse a object or array JSON into a iterator. The `item` of iterator is the LazyValue, which is wrapper of a raw JSON slice.
Parse a object or array JSON into a iterator. The `item` of iterator is the `LazyValue`, which is wrapper of a raw JSON slice.

```
```rs
use bytes::Bytes;
use sonic_rs::{to_array_iter, JsonValue};

Expand All @@ -294,4 +293,4 @@ fn main() {
```

## Contributing
Please read `CONTRIBUTING.md` for information on contributing to sonic-rs.
Please read `CONTRIBUTING.md` for information on contributing to sonic-rs.

0 comments on commit ebf7d8a

Please sign in to comment.