Skip to content

Comments

feat(type,jer): implement Encode/Decode on serde_json::Value#538

Open
mkatychev wants to merge 7 commits intolibrasn:mainfrom
mkatychev:feat/json-encode-decode
Open

feat(type,jer): implement Encode/Decode on serde_json::Value#538
mkatychev wants to merge 7 commits intolibrasn:mainfrom
mkatychev:feat/json-encode-decode

Conversation

@mkatychev
Copy link
Contributor

Structs like this will faild to derive since serde_json::Value (despite being used in the jer module) does not implement Encode/Decode/AsnType:

#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Eq, Clone, AsnType)]
pub struct Foo {
    inner: serde_json::Value
}

Used choice type to implement said traits for serde_json::Value.

const IS_CHOICE: bool = true;
}

impl crate::types::Choice for Value {
Copy link
Contributor Author

@mkatychev mkatychev Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fairly new/clueless as to the ASN.1 standard and am not sure if there anything from X.697 that can be used in this approach though the CHOICE type seemed best to mirror the serde_json::Value enum.

}

// ============================================================
// Test cases adapted from serde-json-canonicalizer https://github.com/evik42/serde-json-canonicalizer
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part of motivation is that json canonicalization is not available in no_std

@mkatychev mkatychev changed the title feat(type): implement Encode/Decode on serde_json::Value feat(type,jer): implement Encode/Decode on serde_json::Value Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant