Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tyilo opened this issue Aug 20, 2024 · 0 comments
Open

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

tyilo opened this issue Aug 20, 2024 · 0 comments

Comments

@tyilo
Copy link

tyilo commented Aug 20, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant