Skip to content
Back to skills

Serde Knowledge Patch

ASecurity

Serde

  • 25 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added May 27, 2026
data-airustgoapidocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill serde-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Serde Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Serde Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-serde-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-serde-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: serde-knowledge-patch
description: Serde
version: "1.0.220"
license: MIT
metadata:
  author: Nevaberry
---


# Serde Knowledge Patch

Use this skill when updating Serde dependencies, working with JSON values,
or checking derive, parsing, and documentation behavior.
The references provide topic-specific guidance and version attributions.

## Reference index

| Reference | Topics |
| --- | --- |
| [Core Traits and Dependencies](references/core-traits-and-dependencies.md) | Dependency selection and pins, deserializer helpers, trait diagnostics, deprecated macros and members, derive spans, vendoring, documentation builds |
| [JSON Compatibility and Value APIs](references/json-compatibility-and-values.md) | Enum object keys, number formatting and comparisons, UTF-8 errors, borrowed defaults, map parsing and deserialization, iterators, raw JSON, object order |

## Compatibility changes and deprecations

### Select dependencies for traits and derives

`serde_json` switches its Serde trait dependency to `serde_core`.
Code that only uses Serde trait bounds or handwritten implementations can
pair `serde_json` with a direct `serde_core` dependency.
If your types derive `Serialize` or `Deserialize`, keep a direct `serde`
dependency with the `derive` feature enabled.

`serde_json` 1.0.145 raises its minimum `serde` version to 1.0.220.
If your project pins an older `serde` version, update that pin or stay on
a `serde_json` release below 1.0.145.

### Remove the deprecated integer macro wrapper

`serde_if_integer128!` is deprecated.
Remove the macro wrapper and keep the enclosed `i128` or `u128` code
to avoid deprecation warnings.

### Quote externally tagged enum variant names

When deserializing an externally tagged enum from a JSON object,
`serde_json` now rejects non-string keys.
Quote the variant name, as in `{"Count": 3}`.

### Check number-string and error-location expectations

With `arbitrary_precision` enabled, `serde_json` now aligns its number
strings with `zmij`'s formatting. Tests that compare JSON number strings
byte for byte may need updated expectations.

Parsing errors for invalid UTF-8 point to the first bad byte.
Tests that assert the error location may need updated expectations.

### Refresh vendored derive dependencies

`serde_derive` now depends on `syn` 3.
If you vendor dependencies for an offline build that uses Serde's `derive`
feature, refresh the vendor directory to include `syn` 3 when upgrading.

## JSON value and map quick reference

### Return a borrowed default after a missing lookup

`&serde_json::Value` implements `Default`.
A missing field lookup can use `unwrap_or_default()` and return a borrowed value.

```rust
use serde_json::{json, Value};

let settings = json!({});
let timeout: &Value = settings.get("timeout").unwrap_or_default();
```

### Parse object text directly into a map

`serde_json::Map<String, Value>` implements `FromStr`, so you can call
`.parse()` on JSON object text.

```rust
use serde_json::{Map, Value};

let fields: Map<String, Value> = r#"{"enabled":true}"#.parse().unwrap();
```

### Deserialize from a map and keep it available

Both `Map<String, Value>` and `&Map<String, Value>` implement `Deserializer`
and `IntoDeserializer`. Pass a map directly to `Deserialize::deserialize`,
or pass a reference to keep the map available for reuse.

```rust
use serde::Deserialize;
use serde_json::{Map, Value};

#[derive(Deserialize)]
struct Config {
    enabled: bool,
}

let fields: Map<String, Value> = serde_json::from_str(r#"{"enabled":true}"#).unwrap();
let config = Config::deserialize(&fields).unwrap();
assert!(config.enabled);
assert!(fields.contains_key("enabled"));
```

### Clone or debug an object iterator

The iterator returned by `serde_json::Map::iter()` implements `Clone`
and `Debug`. Cloning it gives an independent iterator over the remaining
entries from the same position.

## Raw JSON quick reference

### Use static raw literals

With the `raw_value` feature, `RawValue::NULL`, `RawValue::TRUE`, and
`RawValue::FALSE` are each a `&'static RawValue` usable directly where
a raw JSON literal is required.

```rust
use serde_json::value::RawValue;

let raw: &'static RawValue = RawValue::FALSE;
assert_eq!(raw.get(), "false");
```

### Wrap an already-valid owned string

With `raw_value` enabled, `serde_json::value::RawValue::from_string_unchecked`
wraps an owned `String` as raw JSON without validating it.
Use it only when the string is already known to contain exactly one
valid JSON value.

## Number behavior and object order

With `arbitrary_precision` enabled, parsing the JSON number `-0`
preserves its negative sign.

Large finite non-integer numbers in a `Value` compare unequal to
`f32::INFINITY`, even when converting them to `f32` would overflow.

`preserve_order` keeps JSON object keys in insertion order in `no_std`
builds. Disable default features and enable `alloc` and `preserve_order`.

```toml
[dependencies]
serde_json = { version = "1.0.154", default-features = false, features = ["alloc", "preserve_order"] }
```

## Core traits, derives, and documentation

### Forward typed deserializer methods

Format crates implementing `Deserializer` can use
`serde_core::forward_to_deserialize_any!` to forward typed deserializer
methods to `deserialize_any`.

### Interpret trait paths in diagnostics

A missing serialization implementation can appear as
`T: serde_core::ser::Serialize` in an `E0277` diagnostic.
`serde::Serialize` re-exports that same trait. If the type comes from
another crate, check whether that crate provides its implementation
through a `serde` feature.

### Derive with Rust 2024 spans or deprecated members

Code generated by Serde's `Serialize` derive for
`#[serde(serialize_with = "...")]` now compiles when a macro gives the
generated code Rust 2024 spans.

Implementations generated by `#[derive(Serialize, Deserialize)]` no longer
trigger deprecation warnings when accessing a deprecated field or variant.
Types with deprecated members can keep their derives in builds using
`#![deny(deprecated)]`.

### Build documentation with the docs.rs configuration

Serde supports documentation builds that set `RUSTDOCFLAGS='--cfg=docsrs'`
for the whole dependency graph. This allows local crate documentation builds
with the `docsrs` configuration enabled even when Serde is a transitive dependency.

```sh
RUSTDOCFLAGS='--cfg=docsrs' cargo +nightly doc
```

Files in this skill

  • SKILL.md3 KB
  • references/map-operations.md2.4 KB
  • references/rawvalue.md987 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in data-ai →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.