Skip to content
Back to skills

Serde Knowledge Patch

ASecurity

Serde

  • 25 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 5, 2026
developmentrustgoapidocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 4 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-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-serde-knowledge-patch-nevaberry-plugins)

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

Load this skill when updating Serde dependencies, working with derives or
handwritten trait implementations, or using JSON maps, numbers, and raw values.
It also covers documentation builds and JSON object ordering in `no_std` builds.

## Reference index

| Reference | Topics |
| --- | --- |
| [Core Traits and Dependencies](references/core-traits-and-dependencies.md) | Dependency selection and minimums, trait diagnostics, deserializer helper macro, deprecation, derives, vendoring, documentation builds |
| [JSON Compatibility and Value APIs](references/json-compatibility-and-values.md) | Enum object keys, number formatting and comparisons, error locations, borrowed values, map APIs, raw values, object ordering |

## Dependency changes and deprecation

### `serde_json` depends on `serde_core`

`serde_json` 1.0.144 switches its Serde trait dependency to `serde_core`, so
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.

### Minimum Serde version is 1.0.220

`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.

### `serde_if_integer128!` is deprecated

Serde 1.0.221 deprecates `serde_if_integer128!`. Remove the macro wrapper and
keep the enclosed `i128` or `u128` code to avoid deprecation warnings.

### `serde_derive` uses `syn` 3

`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 compatibility changes

### String keys in enum objects

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}`.

### Number formatting with `arbitrary_precision`

With the `arbitrary_precision` feature 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.

### Negative zero with `arbitrary_precision`

With `arbitrary_precision` enabled, `serde_json` 1.0.152 preserves the negative
sign when parsing the JSON number `-0`.

### Comparing JSON numbers with `f32::INFINITY`

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

### Location of invalid UTF-8 errors

In `serde_json` 1.0.153, parsing errors for invalid UTF-8 point to the first bad
byte. Tests that assert the error location may need updated expectations.

## JSON values and object maps

### Borrowed JSON values implement `Default`

`&serde_json::Value` implements `Default`, so 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 JSON objects directly into `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();
```

### Clone and debug JSON object iterators

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

### Deserialize directly from a JSON object map

Since `serde_json` 1.0.131, 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"));
```

## Raw JSON values

### Construct `RawValue` without JSON validation

With the `raw_value` feature 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.

### Static `RawValue` literals

With the `raw_value` feature, `serde_json` 1.0.134 adds `RawValue::NULL`,
`RawValue::TRUE`, and `RawValue::FALSE`. Each is a `&'static RawValue` that can
be used 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");
```

## Derives and handwritten implementations

### Trait paths in compiler errors

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

### Deserializer helper macro

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

### `serialize_with` with Rust 2024 spans

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

### Deprecated members in Serde derives

The implementations generated by `#[derive(Serialize, Deserialize)]` no longer
trigger deprecation warnings when they access a deprecated field or variant.
Types with deprecated members can therefore keep their derives in builds that
use `#![deny(deprecated)]`.

## Documentation and object ordering

### Docs.rs flags across dependencies

Serde 1.0.228 supports documentation builds that set
`RUSTDOCFLAGS='--cfg=docsrs'` for the whole dependency graph. This lets you
build a crate's docs locally with the `docsrs` configuration enabled even when
Serde is a transitive dependency.

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

### Preserve object key order in `no_std` builds

Starting in `serde_json` 1.0.154, `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"] }
```

Files in this skill

  • SKILL.md7.6 KB
  • coverage.json785 B
  • references/core-traits-and-dependencies.md2.7 KB
  • references/json-compatibility-and-values.md5.4 KB

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 development →

Comments

Loading comments…

Newsletter

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