nushell/crates/nu-json
dependabot[bot] 1e2fa68db0
Bump fancy-regex from 0.13.0 to 0.14.0 (#14207)
Bumps [fancy-regex](https://github.com/fancy-regex/fancy-regex) from
0.13.0 to 0.14.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fancy-regex/fancy-regex/releases">fancy-regex's
releases</a>.</em></p>
<blockquote>
<h2>0.14.0</h2>
<h3>Added</h3>
<ul>
<li>Add <code>split</code>, <code>splitn</code> methods to
<code>Regex</code> to split a string into substrings (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/140">#140</a>)</li>
<li>Add <code>case_insensitive</code> method to
<code>RegexBuilder</code> to force case-insensitive mode (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/132">#132</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Bump bit-set dependency to 0.8 (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/139">#139</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/fancy-regex/fancy-regex/blob/main/CHANGELOG.md">fancy-regex's
changelog</a>.</em></p>
<blockquote>
<h2>[0.14.0] - 2024-10-24</h2>
<h3>Added</h3>
<ul>
<li>Add <code>split</code>, <code>splitn</code> methods to
<code>Regex</code> to split a string into substrings (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/140">#140</a>)</li>
<li>Add <code>case_insensitive</code> method to
<code>RegexBuilder</code> to force case-insensitive mode (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/132">#132</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Bump bit-set dependency to 0.8 (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/139">#139</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="810a8f3c16"><code>810a8f3</code></a>
Version 0.14.0</li>
<li><a
href="33597bdd7b"><code>33597bd</code></a>
Merge pull request <a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/145">#145</a>
from fancy-regex/bump-tarpaulin</li>
<li><a
href="1a6c0f813d"><code>1a6c0f8</code></a>
Bump tarpaulin</li>
<li><a
href="2f0f000de9"><code>2f0f000</code></a>
Merge pull request <a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/144">#144</a>
from k94-ishi/dev/splitn</li>
<li><a
href="689a845112"><code>689a845</code></a>
Merge pull request <a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/132">#132</a>
from jonperry-dev/casing_option</li>
<li><a
href="f0183b46a6"><code>f0183b4</code></a>
fix check</li>
<li><a
href="988b357493"><code>988b357</code></a>
fmt</li>
<li><a
href="52105243c1"><code>5210524</code></a>
moved tests to tests/regex_options.rs</li>
<li><a
href="ce4ab06ee3"><code>ce4ab06</code></a>
fmt</li>
<li><a
href="1039f71083"><code>1039f71</code></a>
added self to authors</li>
<li>Additional commits viewable in <a
href="https://github.com/fancy-regex/fancy-regex/compare/0.13.0...0.14.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=fancy-regex&package-manager=cargo&previous-version=0.13.0&new-version=0.14.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-30 10:51:21 +08:00
..
src JSON format output keeps braces on same line (issue #13326) (#13352) 2024-07-14 10:19:09 +02:00
tests Fix CI test failure on main (nu-json) (#13374) 2024-07-14 10:37:57 +02:00
Cargo.toml Bump fancy-regex from 0.13.0 to 0.14.0 (#14207) 2024-10-30 10:51:21 +08:00
CHANGELOG.md remove repetitive word (#12117) 2024-03-08 15:29:20 +08:00
LICENSE Fix rest of license year ranges (#8727) 2023-04-04 09:03:29 +12:00
README.md Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00

nu-json

crate

a fork of serde_hjson.

The changes made to this crate are kept in CHANGELOG.

The Rust implementation of Hjson is based on the Serde JSON Serialization Library.

This crate is a Rust library for parsing and generating Human JSON Hjson. It is built upon Serde, a high performance generic serialization framework.

Install

This crate works with Cargo and can be found on crates.io with a Cargo.toml like:

[dependencies]
serde = "1"
nu-json = "0.76"

From the Commandline

Add with:

 cargo add serde
 cargo add nu-json

Usage

extern crate serde;
extern crate nu_json;

use nu_json::{Map,Value};

fn main() {

    // Now let's look at decoding Hjson data

    let sample_text=r#"
    {
        ## specify rate in requests/second
        rate: 1000
        array:
        [
            foo
            bar
        ]
    }"#;

    // Decode and unwrap.
    let mut sample: Map<String, Value> = nu_json::from_str(&sample_text).unwrap();

    // scope to control lifetime of borrow
    {
        // Extract the rate
        let rate = sample.get("rate").unwrap().as_f64().unwrap();
        println!("rate: {}", rate);

        // Extract the array
        let array : &mut Vec<Value> = sample.get_mut("array").unwrap().as_array_mut().unwrap();
        println!("first: {}", array.first().unwrap());

        // Add a value
        array.push(Value::String("baz".to_string()));
    }

    // Encode to Hjson
    let sample2 = nu_json::to_string(&sample).unwrap();
    println!("Hjson:\n{}", sample2);
}

DOCS

At the moment, the documentation on serde_hjson / serde_json is also relevant for nu-json.