Skip to content

Commit

Permalink
Rename json-rust to jzon-rs
Browse files Browse the repository at this point in the history
Signed-off-by: Sandro-Alessio Gierens <[email protected]>
  • Loading branch information
gierens committed Aug 25, 2023
1 parent a8d6b6d commit 56f7310
Show file tree
Hide file tree
Showing 17 changed files with 107 additions and 101 deletions.
13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
[package]
name = "json"
name = "jzon"
description = "Continuation of json-rust, a JSON implementation in Rust"
authors = [
"Sandro-Alessio Gierens <[email protected]>",
"Maciej Hirsz <[email protected]>"
]
documentation = "https://docs.rs/jzon/"
repository = "https://github.com/gierens/jzon-rs"
version = "0.12.4"
authors = ["Maciej Hirsz <[email protected]>"]
description = "JSON implementation in Rust"
repository = "https://github.com/maciejhirsz/json-rust"
documentation = "https://docs.rs/json/"
license = "MIT/Apache-2.0"
edition = "2018"
1 change: 1 addition & 0 deletions LICENSE-APACHE
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ APPENDIX: How to apply the Apache License to your work.
identification within third-party archives.

Copyright 2016 Maciej Hirsz <[email protected]>
Copyright 2023 Sandro-Alessio Gierens <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
1 change: 1 addition & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (c) 2016 Maciej Hirsz <[email protected]>
Copyright (c) 2023 Sandro-Alessio Gierens <[email protected]>

The MIT License (MIT)

Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
![](https://raw.githubusercontent.com/maciejhirsz/json-rust/master/json-rust-logo-small.png)
# jzon-rs

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

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

**[Changelog](https://github.com/maciejhirsz/json-rust/releases) -**
**[Complete Documentation](https://docs.rs/json/) -**
**[Cargo](https://crates.io/crates/json) -**
**[Repository](https://github.com/maciejhirsz/json-rust)**
**[Changelog](https://github.com/gierens/jzon-rs/releases) -**
**[Complete Documentation](https://docs.rs/jzon/) -**
**[Cargo](https://crates.io/crates/jzon) -**
**[Repository](https://github.com/gierens/jzon-rs)**

## Why?

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

```rust
let parsed = json::parse(r#"
let parsed = jzon::parse(r#"
{
"code": 200,
Expand Down Expand Up @@ -98,14 +99,14 @@ Just add it to your `Cargo.toml` file:

```toml
[dependencies]
json = "*"
jzon = "*"
```

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

```rust
#[macro_use]
extern crate json;
extern crate jzon;
```

## Performance and Conformance
Expand Down
14 changes: 7 additions & 7 deletions benches/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// for the Country enum
// #![recursion_limit="259"]

extern crate json;
extern crate jzon;
extern crate test;
// extern crate serde;
// extern crate serde_json;
Expand Down Expand Up @@ -233,7 +233,7 @@ fn json_rust_parse(b: &mut Bencher) {
b.bytes = JSON_STR.len() as u64;

b.iter(|| {
json::parse(JSON_STR).unwrap();
jzon::parse(JSON_STR).unwrap();
});
}

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

b.iter(|| {
json::parse(JSON_FLOAT_STR).unwrap();
jzon::parse(JSON_FLOAT_STR).unwrap();
});
}

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

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

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

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

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

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

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

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

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{ char, error, fmt };
///
///
/// *Note:* Since `0.9.0` using `JsonError` is deprecated. Always use
/// `json::Error` instead!
/// `jzon::Error` instead!
#[derive(Debug, PartialEq, Eq)]
pub enum Error {
UnexpectedCharacter {
Expand Down
48 changes: 24 additions & 24 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
//! This crate intends to avoid that friction.
//!
//! ```rust
//! # #[macro_use] extern crate json;
//! # #[macro_use] extern crate jzon;
//! # fn main() {
//! let parsed = json::parse(r#"
//! let parsed = jzon::parse(r#"
//!
//! {
//! "code": 200,
Expand Down Expand Up @@ -59,7 +59,7 @@
//! Using macros and indexing, it's easy to work with the data.
//!
//! ```rust
//! # #[macro_use] extern crate json;
//! # #[macro_use] extern crate jzon;
//! # fn main() {
//! let mut data = object!{
//! foo: false,
Expand Down Expand Up @@ -98,59 +98,59 @@
//! # }
//! ```
//!
//! ## Serialize with `json::stringify(value)`
//! ## Serialize with `jzon::stringify(value)`
//!
//! Primitives:
//!
//! ```
//! // str slices
//! assert_eq!(json::stringify("foobar"), "\"foobar\"");
//! assert_eq!(jzon::stringify("foobar"), "\"foobar\"");
//!
//! // Owned strings
//! assert_eq!(json::stringify("foobar".to_string()), "\"foobar\"");
//! assert_eq!(jzon::stringify("foobar".to_string()), "\"foobar\"");
//!
//! // Any number types
//! assert_eq!(json::stringify(42), "42");
//! assert_eq!(jzon::stringify(42), "42");
//!
//! // Booleans
//! assert_eq!(json::stringify(true), "true");
//! assert_eq!(json::stringify(false), "false");
//! assert_eq!(jzon::stringify(true), "true");
//! assert_eq!(jzon::stringify(false), "false");
//! ```
//!
//! Explicit `null` type `json::Null`:
//! Explicit `null` type `jzon::Null`:
//!
//! ```
//! assert_eq!(json::stringify(json::Null), "null");
//! assert_eq!(jzon::stringify(jzon::Null), "null");
//! ```
//!
//! Optional types:
//!
//! ```
//! let value: Option<String> = Some("foo".to_string());
//! assert_eq!(json::stringify(value), "\"foo\"");
//! assert_eq!(jzon::stringify(value), "\"foo\"");
//!
//! let no_value: Option<String> = None;
//! assert_eq!(json::stringify(no_value), "null");
//! assert_eq!(jzon::stringify(no_value), "null");
//! ```
//!
//! Vector:
//!
//! ```
//! let data = vec![1,2,3];
//! assert_eq!(json::stringify(data), "[1,2,3]");
//! assert_eq!(jzon::stringify(data), "[1,2,3]");
//! ```
//!
//! Vector with optional values:
//!
//! ```
//! let data = vec![Some(1), None, Some(2), None, Some(3)];
//! assert_eq!(json::stringify(data), "[1,null,2,null,3]");
//! assert_eq!(jzon::stringify(data), "[1,null,2,null,3]");
//! ```
//!
//! Pushing to arrays:
//!
//! ```
//! let mut data = json::JsonValue::new_array();
//! let mut data = jzon::JsonValue::new_array();
//!
//! data.push(10);
//! data.push("foo");
Expand All @@ -162,7 +162,7 @@
//! Putting fields on objects:
//!
//! ```
//! let mut data = json::JsonValue::new_object();
//! let mut data = jzon::JsonValue::new_object();
//!
//! data["answer"] = 42.into();
//! data["foo"] = "bar".into();
Expand All @@ -173,7 +173,7 @@
//! `array!` macro:
//!
//! ```
//! # #[macro_use] extern crate json;
//! # #[macro_use] extern crate jzon;
//! # fn main() {
//! let data = array!["foo", "bar", 100, true, null];
//! assert_eq!(data.dump(), r#"["foo","bar",100,true,null]"#);
Expand All @@ -183,7 +183,7 @@
//! `object!` macro:
//!
//! ```
//! # #[macro_use] extern crate json;
//! # #[macro_use] extern crate jzon;
//! # fn main() {
//! let data = object!{
//! name: "John Doe",
Expand Down Expand Up @@ -217,7 +217,7 @@ pub use value::JsonValue::Null;
///
///
/// *Note:* Since 0.9.0 the old `JsonResult` type is deprecated. Always use
/// `json::Result` instead.
/// `jzon::Result` instead.
pub type Result<T> = result::Result<T, Error>;

pub mod iterators {
Expand All @@ -234,10 +234,10 @@ pub mod iterators {
pub type EntriesMut<'a> = super::object::IterMut<'a>;
}

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

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

pub use parser::parse;
Expand Down Expand Up @@ -265,7 +265,7 @@ pub fn stringify_pretty<T>(root: T, spaces: u16) -> String where T: Into<JsonVal
/// Helper macro for creating instances of `JsonValue::Array`.
///
/// ```
/// # #[macro_use] extern crate json;
/// # #[macro_use] extern crate jzon;
/// # fn main() {
/// let data = array!["foo", 42, false];
///
Expand Down Expand Up @@ -344,7 +344,7 @@ macro_rules! value {
/// Helper macro for creating instances of `JsonValue::Object`.
///
/// ```
/// # #[macro_use] extern crate json;
/// # #[macro_use] extern crate jzon;
/// # fn main() {
/// let data = object!{
/// foo: 42,
Expand Down
12 changes: 6 additions & 6 deletions src/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const NAN_MASK: u8 = !1;
/// equality operator with another number type.
///
/// ```
/// # use json::number::Number;
/// # use jzon::number::Number;
/// let foo: Number = 3.14.into();
/// let bar: f64 = foo.into();
///
Expand Down Expand Up @@ -50,7 +50,7 @@ impl Number {
/// Construct a new `Number` from parts. This can't create a NaN value.
///
/// ```
/// # use json::number::Number;
/// # use jzon::number::Number;
/// let pi = unsafe { Number::from_parts_unchecked(true, 3141592653589793, -15) };
///
/// assert_eq!(pi, 3.141592653589793);
Expand All @@ -72,7 +72,7 @@ impl Number {
/// This can't create a NaN value.
///
/// ```
/// # use json::number::Number;
/// # use jzon::number::Number;
/// let one = Number::from_parts(true, 1000, -3);
/// let (positive, mantissa, exponent) = one.as_parts();
///
Expand All @@ -92,7 +92,7 @@ impl Number {
/// Reverse to `from_parts` - obtain parts from an existing `Number`.
///
/// ```
/// # use json::number::Number;
/// # use jzon::number::Number;
/// let pi = Number::from(3.141592653589793);
/// let (positive, mantissa, exponent) = pi.as_parts();
///
Expand Down Expand Up @@ -133,7 +133,7 @@ impl Number {
/// Will return `None` if `Number` is negative or a NaN.
///
/// ```
/// # use json::number::Number;
/// # use jzon::number::Number;
/// let price_a = Number::from(5.99);
/// let price_b = Number::from(7);
/// let price_c = Number::from(10.2);
Expand Down Expand Up @@ -162,7 +162,7 @@ impl Number {
/// `i64`, properly handling negative numbers.
///
/// ```
/// # use json::number::Number;
/// # use jzon::number::Number;
/// let balance_a = Number::from(-1.49);
/// let balance_b = Number::from(42);
///
Expand Down
8 changes: 4 additions & 4 deletions src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,8 @@ impl<'a> ExactSizeIterator for IterMut<'a> {
///
/// ```
/// # #[macro_use]
/// # extern crate json;
/// # use json::JsonValue;
/// # extern crate jzon;
/// # use jzon::JsonValue;
/// #
/// # fn main() {
/// let value = object!{
Expand Down Expand Up @@ -696,8 +696,8 @@ impl<'a> Index<&'a String> for Object {
///
/// ```
/// # #[macro_use]
/// # extern crate json;
/// # use json::JsonValue;
/// # extern crate jzon;
/// # use jzon::JsonValue;
/// #
/// # fn main() {
/// let value = object!{};
Expand Down
Loading

0 comments on commit 56f7310

Please sign in to comment.