Skip to content

Commit 56f7310

Browse files
committed
Rename json-rust to jzon-rs
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
1 parent a8d6b6d commit 56f7310

File tree

17 files changed

+107
-101
lines changed

17 files changed

+107
-101
lines changed

Cargo.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
[package]
2-
name = "json"
2+
name = "jzon"
3+
description = "Continuation of json-rust, a JSON implementation in Rust"
4+
authors = [
5+
"Sandro-Alessio Gierens <sandro@gierens.de>",
6+
"Maciej Hirsz <hello@maciej.codes>"
7+
]
8+
documentation = "https://docs.rs/jzon/"
9+
repository = "https://github.com/gierens/jzon-rs"
310
version = "0.12.4"
4-
authors = ["Maciej Hirsz <hello@maciej.codes>"]
5-
description = "JSON implementation in Rust"
6-
repository = "https://github.com/maciejhirsz/json-rust"
7-
documentation = "https://docs.rs/json/"
811
license = "MIT/Apache-2.0"
912
edition = "2018"

LICENSE-APACHE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ APPENDIX: How to apply the Apache License to your work.
187187
identification within third-party archives.
188188

189189
Copyright 2016 Maciej Hirsz <maciej.hirsz@gmail.com>
190+
Copyright 2023 Sandro-Alessio Gierens <sandro@gierens.de>
190191

191192
Licensed under the Apache License, Version 2.0 (the "License");
192193
you may not use this file except in compliance with the License.

LICENSE-MIT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Copyright (c) 2016 Maciej Hirsz <maciej.hirsz@gmail.com>
2+
Copyright (c) 2023 Sandro-Alessio Gierens <sandro@gierens.de>
23

34
The MIT License (MIT)
45

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
![](https://raw.githubusercontent.com/maciejhirsz/json-rust/master/json-rust-logo-small.png)
1+
# jzon-rs
22

3-
# json-rust
3+
![](https://raw.githubusercontent.com/gierens/jzon-rs/master/json-rust-logo-small.png)
44

5-
Parse and serialize [JSON](http://json.org/) with ease.
5+
Continuation of [json-rust](https://github.com/maciejhirsz/json-rust),
6+
a rust library to parse and serialize [JSON](http://json.org/) with ease.
67

7-
**[Changelog](https://github.com/maciejhirsz/json-rust/releases) -**
8-
**[Complete Documentation](https://docs.rs/json/) -**
9-
**[Cargo](https://crates.io/crates/json) -**
10-
**[Repository](https://github.com/maciejhirsz/json-rust)**
8+
**[Changelog](https://github.com/gierens/jzon-rs/releases) -**
9+
**[Complete Documentation](https://docs.rs/jzon/) -**
10+
**[Cargo](https://crates.io/crates/jzon) -**
11+
**[Repository](https://github.com/gierens/jzon-rs)**
1112

1213
## Why?
1314

@@ -19,7 +20,7 @@ introduces friction.
1920
This crate intends to avoid that friction.
2021

2122
```rust
22-
let parsed = json::parse(r#"
23+
let parsed = jzon::parse(r#"
2324
2425
{
2526
"code": 200,
@@ -98,14 +99,14 @@ Just add it to your `Cargo.toml` file:
9899

99100
```toml
100101
[dependencies]
101-
json = "*"
102+
jzon = "*"
102103
```
103104

104105
Then import it in your `main.rs` / `lib.rs` file:
105106

106107
```rust
107108
#[macro_use]
108-
extern crate json;
109+
extern crate jzon;
109110
```
110111

111112
## Performance and Conformance

benches/log.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// for the Country enum
88
// #![recursion_limit="259"]
99

10-
extern crate json;
10+
extern crate jzon;
1111
extern crate test;
1212
// extern crate serde;
1313
// extern crate serde_json;
@@ -233,7 +233,7 @@ fn json_rust_parse(b: &mut Bencher) {
233233
b.bytes = JSON_STR.len() as u64;
234234

235235
b.iter(|| {
236-
json::parse(JSON_STR).unwrap();
236+
jzon::parse(JSON_STR).unwrap();
237237
});
238238
}
239239

@@ -242,13 +242,13 @@ fn json_rust_parse_floats(b: &mut Bencher) {
242242
b.bytes = JSON_FLOAT_STR.len() as u64;
243243

244244
b.iter(|| {
245-
json::parse(JSON_FLOAT_STR).unwrap();
245+
jzon::parse(JSON_FLOAT_STR).unwrap();
246246
});
247247
}
248248

249249
#[bench]
250250
fn json_rust_stringify(b: &mut Bencher) {
251-
let data = json::parse(JSON_STR).unwrap();
251+
let data = jzon::parse(JSON_STR).unwrap();
252252

253253
b.bytes = data.dump().len() as u64;
254254

@@ -259,7 +259,7 @@ fn json_rust_stringify(b: &mut Bencher) {
259259

260260
#[bench]
261261
fn json_rust_stringify_io_write(b: &mut Bencher) {
262-
let data = json::parse(JSON_STR).unwrap();
262+
let data = jzon::parse(JSON_STR).unwrap();
263263

264264
b.bytes = data.dump().len() as u64;
265265

@@ -272,7 +272,7 @@ fn json_rust_stringify_io_write(b: &mut Bencher) {
272272

273273
#[bench]
274274
fn json_rust_stringify_floats(b: &mut Bencher) {
275-
let data = json::parse(JSON_FLOAT_STR).unwrap();
275+
let data = jzon::parse(JSON_FLOAT_STR).unwrap();
276276

277277
b.bytes = data.dump().len() as u64;
278278

@@ -283,7 +283,7 @@ fn json_rust_stringify_floats(b: &mut Bencher) {
283283

284284
#[bench]
285285
fn json_rust_stringify_floats_io_write(b: &mut Bencher) {
286-
let data = json::parse(JSON_FLOAT_STR).unwrap();
286+
let data = jzon::parse(JSON_FLOAT_STR).unwrap();
287287

288288
b.bytes = data.dump().len() as u64;
289289

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{ char, error, fmt };
44
///
55
///
66
/// *Note:* Since `0.9.0` using `JsonError` is deprecated. Always use
7-
/// `json::Error` instead!
7+
/// `jzon::Error` instead!
88
#[derive(Debug, PartialEq, Eq)]
99
pub enum Error {
1010
UnexpectedCharacter {

src/lib.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
//! This crate intends to avoid that friction.
2020
//!
2121
//! ```rust
22-
//! # #[macro_use] extern crate json;
22+
//! # #[macro_use] extern crate jzon;
2323
//! # fn main() {
24-
//! let parsed = json::parse(r#"
24+
//! let parsed = jzon::parse(r#"
2525
//!
2626
//! {
2727
//! "code": 200,
@@ -59,7 +59,7 @@
5959
//! Using macros and indexing, it's easy to work with the data.
6060
//!
6161
//! ```rust
62-
//! # #[macro_use] extern crate json;
62+
//! # #[macro_use] extern crate jzon;
6363
//! # fn main() {
6464
//! let mut data = object!{
6565
//! foo: false,
@@ -98,59 +98,59 @@
9898
//! # }
9999
//! ```
100100
//!
101-
//! ## Serialize with `json::stringify(value)`
101+
//! ## Serialize with `jzon::stringify(value)`
102102
//!
103103
//! Primitives:
104104
//!
105105
//! ```
106106
//! // str slices
107-
//! assert_eq!(json::stringify("foobar"), "\"foobar\"");
107+
//! assert_eq!(jzon::stringify("foobar"), "\"foobar\"");
108108
//!
109109
//! // Owned strings
110-
//! assert_eq!(json::stringify("foobar".to_string()), "\"foobar\"");
110+
//! assert_eq!(jzon::stringify("foobar".to_string()), "\"foobar\"");
111111
//!
112112
//! // Any number types
113-
//! assert_eq!(json::stringify(42), "42");
113+
//! assert_eq!(jzon::stringify(42), "42");
114114
//!
115115
//! // Booleans
116-
//! assert_eq!(json::stringify(true), "true");
117-
//! assert_eq!(json::stringify(false), "false");
116+
//! assert_eq!(jzon::stringify(true), "true");
117+
//! assert_eq!(jzon::stringify(false), "false");
118118
//! ```
119119
//!
120-
//! Explicit `null` type `json::Null`:
120+
//! Explicit `null` type `jzon::Null`:
121121
//!
122122
//! ```
123-
//! assert_eq!(json::stringify(json::Null), "null");
123+
//! assert_eq!(jzon::stringify(jzon::Null), "null");
124124
//! ```
125125
//!
126126
//! Optional types:
127127
//!
128128
//! ```
129129
//! let value: Option<String> = Some("foo".to_string());
130-
//! assert_eq!(json::stringify(value), "\"foo\"");
130+
//! assert_eq!(jzon::stringify(value), "\"foo\"");
131131
//!
132132
//! let no_value: Option<String> = None;
133-
//! assert_eq!(json::stringify(no_value), "null");
133+
//! assert_eq!(jzon::stringify(no_value), "null");
134134
//! ```
135135
//!
136136
//! Vector:
137137
//!
138138
//! ```
139139
//! let data = vec![1,2,3];
140-
//! assert_eq!(json::stringify(data), "[1,2,3]");
140+
//! assert_eq!(jzon::stringify(data), "[1,2,3]");
141141
//! ```
142142
//!
143143
//! Vector with optional values:
144144
//!
145145
//! ```
146146
//! let data = vec![Some(1), None, Some(2), None, Some(3)];
147-
//! assert_eq!(json::stringify(data), "[1,null,2,null,3]");
147+
//! assert_eq!(jzon::stringify(data), "[1,null,2,null,3]");
148148
//! ```
149149
//!
150150
//! Pushing to arrays:
151151
//!
152152
//! ```
153-
//! let mut data = json::JsonValue::new_array();
153+
//! let mut data = jzon::JsonValue::new_array();
154154
//!
155155
//! data.push(10);
156156
//! data.push("foo");
@@ -162,7 +162,7 @@
162162
//! Putting fields on objects:
163163
//!
164164
//! ```
165-
//! let mut data = json::JsonValue::new_object();
165+
//! let mut data = jzon::JsonValue::new_object();
166166
//!
167167
//! data["answer"] = 42.into();
168168
//! data["foo"] = "bar".into();
@@ -173,7 +173,7 @@
173173
//! `array!` macro:
174174
//!
175175
//! ```
176-
//! # #[macro_use] extern crate json;
176+
//! # #[macro_use] extern crate jzon;
177177
//! # fn main() {
178178
//! let data = array!["foo", "bar", 100, true, null];
179179
//! assert_eq!(data.dump(), r#"["foo","bar",100,true,null]"#);
@@ -183,7 +183,7 @@
183183
//! `object!` macro:
184184
//!
185185
//! ```
186-
//! # #[macro_use] extern crate json;
186+
//! # #[macro_use] extern crate jzon;
187187
//! # fn main() {
188188
//! let data = object!{
189189
//! name: "John Doe",
@@ -217,7 +217,7 @@ pub use value::JsonValue::Null;
217217
///
218218
///
219219
/// *Note:* Since 0.9.0 the old `JsonResult` type is deprecated. Always use
220-
/// `json::Result` instead.
220+
/// `jzon::Result` instead.
221221
pub type Result<T> = result::Result<T, Error>;
222222

223223
pub mod iterators {
@@ -234,10 +234,10 @@ pub mod iterators {
234234
pub type EntriesMut<'a> = super::object::IterMut<'a>;
235235
}
236236

237-
#[deprecated(since="0.9.0", note="use `json::Error` instead")]
237+
#[deprecated(since="0.9.0", note="use `jzon::Error` instead")]
238238
pub use Error as JsonError;
239239

240-
#[deprecated(since="0.9.0", note="use `json::Result` instead")]
240+
#[deprecated(since="0.9.0", note="use `jzon::Result` instead")]
241241
pub use crate::Result as JsonResult;
242242

243243
pub use parser::parse;
@@ -265,7 +265,7 @@ pub fn stringify_pretty<T>(root: T, spaces: u16) -> String where T: Into<JsonVal
265265
/// Helper macro for creating instances of `JsonValue::Array`.
266266
///
267267
/// ```
268-
/// # #[macro_use] extern crate json;
268+
/// # #[macro_use] extern crate jzon;
269269
/// # fn main() {
270270
/// let data = array!["foo", 42, false];
271271
///
@@ -344,7 +344,7 @@ macro_rules! value {
344344
/// Helper macro for creating instances of `JsonValue::Object`.
345345
///
346346
/// ```
347-
/// # #[macro_use] extern crate json;
347+
/// # #[macro_use] extern crate jzon;
348348
/// # fn main() {
349349
/// let data = object!{
350350
/// foo: 42,

src/number.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const NAN_MASK: u8 = !1;
2020
/// equality operator with another number type.
2121
///
2222
/// ```
23-
/// # use json::number::Number;
23+
/// # use jzon::number::Number;
2424
/// let foo: Number = 3.14.into();
2525
/// let bar: f64 = foo.into();
2626
///
@@ -50,7 +50,7 @@ impl Number {
5050
/// Construct a new `Number` from parts. This can't create a NaN value.
5151
///
5252
/// ```
53-
/// # use json::number::Number;
53+
/// # use jzon::number::Number;
5454
/// let pi = unsafe { Number::from_parts_unchecked(true, 3141592653589793, -15) };
5555
///
5656
/// assert_eq!(pi, 3.141592653589793);
@@ -72,7 +72,7 @@ impl Number {
7272
/// This can't create a NaN value.
7373
///
7474
/// ```
75-
/// # use json::number::Number;
75+
/// # use jzon::number::Number;
7676
/// let one = Number::from_parts(true, 1000, -3);
7777
/// let (positive, mantissa, exponent) = one.as_parts();
7878
///
@@ -92,7 +92,7 @@ impl Number {
9292
/// Reverse to `from_parts` - obtain parts from an existing `Number`.
9393
///
9494
/// ```
95-
/// # use json::number::Number;
95+
/// # use jzon::number::Number;
9696
/// let pi = Number::from(3.141592653589793);
9797
/// let (positive, mantissa, exponent) = pi.as_parts();
9898
///
@@ -133,7 +133,7 @@ impl Number {
133133
/// Will return `None` if `Number` is negative or a NaN.
134134
///
135135
/// ```
136-
/// # use json::number::Number;
136+
/// # use jzon::number::Number;
137137
/// let price_a = Number::from(5.99);
138138
/// let price_b = Number::from(7);
139139
/// let price_c = Number::from(10.2);
@@ -162,7 +162,7 @@ impl Number {
162162
/// `i64`, properly handling negative numbers.
163163
///
164164
/// ```
165-
/// # use json::number::Number;
165+
/// # use jzon::number::Number;
166166
/// let balance_a = Number::from(-1.49);
167167
/// let balance_b = Number::from(42);
168168
///

src/object.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,8 @@ impl<'a> ExactSizeIterator for IterMut<'a> {
649649
///
650650
/// ```
651651
/// # #[macro_use]
652-
/// # extern crate json;
653-
/// # use json::JsonValue;
652+
/// # extern crate jzon;
653+
/// # use jzon::JsonValue;
654654
/// #
655655
/// # fn main() {
656656
/// let value = object!{
@@ -696,8 +696,8 @@ impl<'a> Index<&'a String> for Object {
696696
///
697697
/// ```
698698
/// # #[macro_use]
699-
/// # extern crate json;
700-
/// # use json::JsonValue;
699+
/// # extern crate jzon;
700+
/// # use jzon::JsonValue;
701701
/// #
702702
/// # fn main() {
703703
/// let value = object!{};

0 commit comments

Comments
 (0)