Describe the proposed feature
Hi,
For json document hash use cases, it is mandatory to always have the same json representation for a same set of data.
This is the purpose of https://www.rfc-editor.org/info/rfc8785/
What other libraries (C++ or other) have this feature?
Seen it https://github.com/mirkokiefer/canonical-json and https://github.com/rezn-project/rezn-jcsd - not tested
Include a code fragment with sample data that illustrates the use of this feature
Exemples from here https://connect2id.com/blog/how-to-secure-json-objects-with-hmac (not my production)
Given
{"key":"9cea8d2d","name":"Alice Adams","age":21}
{"key":"9cea8d2d","age":21,"name":"Alice Adams"}
and
{
"key" : "9cea8d2d",
"name" : "Alice Adams",
"age" : 21
}
The canonical version of it is a deterministic string whatever is the order of the keys on the input document.
std::cout << normalize(data) << std::endl;
Would give
{"age":21,"key":"9cea8d2d","name":"Alice Adams"}
and this for every format of the same data set.
Describe the proposed feature
Hi,
For json document hash use cases, it is mandatory to always have the same json representation for a same set of data.
This is the purpose of https://www.rfc-editor.org/info/rfc8785/
What other libraries (C++ or other) have this feature?
Seen it https://github.com/mirkokiefer/canonical-json and https://github.com/rezn-project/rezn-jcsd - not tested
Include a code fragment with sample data that illustrates the use of this feature
Exemples from here https://connect2id.com/blog/how-to-secure-json-objects-with-hmac (not my production)
Given
{"key":"9cea8d2d","name":"Alice Adams","age":21}{"key":"9cea8d2d","age":21,"name":"Alice Adams"}and
The canonical version of it is a deterministic string whatever is the order of the keys on the input document.
std::cout << normalize(data) << std::endl;Would give
{"age":21,"key":"9cea8d2d","name":"Alice Adams"}and this for every format of the same data set.