According to the documentation:'It is critical to select a serialization scheme which is deterministic across executions of the transaction, across platforms, and across versions of the serialization framework. Data structures which don’t enforce ordered serialization (e.g. sets, maps, dicts) should be avoided.'https://sawtooth.hyperledger.org/docs/core/releases/1.2.6/architecture/global_state.html?highlight=deterministic
Because in javascript most variables are maps, it's not clear how one should should store data.
Thus, storing general JSON data would seem to be a bad idea, as in:
Get code examples like 'json.stringify in node js' instantly right from your google search results with the Grepper Chrome Extension.
Although JSON.stringify is to a certain extent deterministic (Is JSON.stringify() deterministic in V8?)
- (Node.js) JWE Using General JWE JSON Serialization. This example duplicates the example A.4 in RFC 7516 for JSON Web Encryption (JWE). This example demonstrates the capability for encrypting the same plaintext to multiple recipients. Two recipients are present in this example. Note: This example requires Chilkat v9.5.0.66 or greater.
- Simple Example of jQuery serialize Form to php array. JQuery providing many methods for serialize object and into array.There are specific method for each serialize types.You can use serialize, serializeArray and jQuery.param. There are following method is used for serialization: 1 – serialize: jQuery form serialize into Object.
- The serialize function is just given a compatible shape to a complex data structure that the PHP can handle that data after that you can reverse the work by using the unserialize function. Most often, we need to store a complex array in the database or in a file from PHP.
- The value to be serialized. Serialize handles all types, except the resource-type and some object s (see note below). You can even serialize arrays that contain references to itself. Circular references inside the array/object you are serializing will also be stored.
Also cbor and protobuff might not be recommended because they do not enforce an ordering:
'The CBOR data model for maps does not allow ascribing semantics tothe order of the key/value pairs in the map representation.'https://tools.ietf.org/html/rfc7049
Js Form Serialize
'By default, repeated invocations of serialization methods on the same protocol buffer message instance may not return the same byte output; i.e. the default serialization is not deterministic.'https://developers.google.com/protocol-buffers/docs/encoding
'Wire format ordering and map iteration ordering of map values is undefined, so you cannot rely on your map items being in a particular order.'https://developers.google.com/protocol-buffers/docs/proto3#maps
From the documentation the only examples I've seen are storing a String with a specific format:https://github.com/hyperledger/sawtooth-sdk-javascript/blob/master/examples/xo/state.js
Or storing a single cbor encoded value:https://github.com/hyperledger/sawtooth-sdk-javascript/blob/master/examples/intkey/handler.js
Js Serialize Function
Node Js Read Json
However, both approaches seem very limited.