Skip to content

Mention in documentation that Value can't represent all valid JSON data #1180

Open
@tyilo

Description

@tyilo

Currently the README includes this text:

Any valid JSON data can be manipulated in the following recursive enum representation. This data structure is serde_json::Value.

enum Value {
    Null,
    Bool(bool),
    Number(Number),
    String(String),
    Array(Vec<Value>),
    Object(Map<String, Value>),
}

The documentation for serde_json::Value includes a similar statement.

However, this is not true as both

{
  "foo": "\ud800"
}

and

{
  "\ud800": "bar"
}

are valid JSON data but cannot be represented by the Value enum.

It would be nice to add a note explaining that invalid UTF-16 surrogate pairs are not supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions