Serialization of some classes can be more finely controlled using serialization options (which are represented using classes that implement the IBsonSerializationOptions interface). Whether a class uses serialization options or not, and which ones, depends on the particular class involved.
Php Serialize Class
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
Php Serialize Json
- NodeJS Writes JSON Objects to WordPress Rest API. Any JSON String or Object, will be saved into serialized PHP string by WordPress. Surprisingly, when NodeJS read the data save in serialize string, NodeJS can read it as JSON object without needs to call JSON.parse.
- Integrating Node.js with PHP 1. Integrating Node.js with PHP Lee Boynton PHPHants March 2013 Meetup 2. If you think anything is missing or something isn’t clear about using json data in node.js. How To Dockerize A Multi-Container App. A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
- The serialize function converts a storable representation of a value. To serialize data means to convert a value to a sequence of bits, so that it can be stored in a file, a memory buffer, or transmitted across a network.
Because in javascript most variables are maps, it's not clear how one should should store data.
Js Form Serialize
Thus, storing general JSON data would seem to be a bad idea, as in:
Php Serialize Data
Although JSON.stringify is to a certain extent deterministic (Is JSON.stringify() deterministic in V8?)
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
'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
However, both approaches seem very limited.