Сериализация JSON хедера rsb.

    @params -- параметры в формате JSON (dfparser.def_values.DEF_RSH_PARAMS)
    @return -- бинарный хедер (2048 bytes)
760904
def serialize_to_rsb(params: dict) -> bytes:
    
    header = bytearray(np.zeros(2048, np.byte).tostring())

    if "text_header_size" in params:
        header[0:4] = struct.pack('I', params["text_header_size"])

    if "events_num" in params:
        header[8:12] = struct.pack('i', params["events_num"])

    if "start_time" in params:
        start_time = dateutil.parser.parse(params["start_time"]).timestamp()
        header[16:24] = struct.pack('Q', int(start_time))

    if "end_time" in params:
        end_time = dateutil.parser.parse(params["end_time"]).timestamp()
        header[24:32] = struct.pack('Q', int(end_time))

    header[32:32 + len(params["filepath"])
           ] = params['filepath'].encode('cp1251')

    header[288:292] = struct.pack('i', params["num_blocks"])

    header[292:296] = struct.pack('i', int(params["aquisition_time"]))

    header[296:300] = struct.pack('i', params["blocks_in_file"])

    header[300:304] = struct.pack('i', int(params["waitTime"]))

    header[312:320] = struct.pack('d', params["threshold"])

    sync_params = params["synchro_control"]
    sync_params_num = len(sync_params)

    header[336:340] = struct.pack('I', sync_params_num)

    for i in range(sync_params_num):
        if sync_params[i] == 'Default':
            code = 0
        else:
            code = synchro_control[sync_params[i]]

        header[320 + i * 4:320 + (i + 1) * 4] = struct.pack('I', code)

    header[344:352] = struct.pack('d', params["sample_freq"])
    header[352:356] = struct.pack('I', params["pre_history"])

    header[356:360] = struct.pack('i', params["packet_number"])

    header[360:364] = struct.pack('I', params["b_size"])

    header[364:368] = struct.pack('I', params["hysteresis"])

    header[368:372] = struct.pack('I', params["channel_number"])

    for i in range(params["channel_number"]):
        off = 372 + 56 * i

        ch_param = params['channel'][i]

        header[off + 44: off + 52] = struct.pack('d', ch_param["adjustment"])
        header[off + 52: off + 56] = struct.pack('I', ch_param["gain"])
        header[off + 36: off + 40] = struct.pack('I', len(ch_param['params']))

        for j, param in enumerate(ch_param['params']):
            if param == 'Default':
                code = 0
            else:
                code = channel_control[param]
                header[off + 4 + j * 4:
                       off + 4 + (j + 1) * 4] = struct.pack('I', code)

    synchro_channel = params['synchro_channel']
    header[632:636] = struct.pack('I', len(synchro_channel['params']))

    for i, param in enumerate(synchro_channel['params']):
        if param == 'Default':
            code = 0
        else:
            code = synchro_channel_control[param]
            header[600 + i * 4: 600 + (i + 1) * 4] = struct.pack('I', code)

    sync_type = synchro_channel_types[synchro_channel['type']]
    header[304:308] = struct.pack('I', sync_type)

    header[636:640] = struct.pack('I', synchro_channel["gain"])

    if "err_lang" in params:
        header[640:644] = struct.pack('I', params["err_lang"])

    if "board_name" in params:
        header[644:644 + len(params["board_name"])] = \
            params['board_name'].encode('cp1251')

    if "board_id" in params:
        header[900: 904] = struct.pack('I', params["board_id"])

    return bytes(header)
305585
def to_h(values_only: false, with_values: false, with_errors: false)
      if values_only
        Hash[*options.flat_map {|opt| [opt.name, opt.type == 'group' ? opt.value.to_h(values_only: true) : opt.value]}]
      else
        Hash[*options.flat_map {|opt| [opt.name, opt.to_h(with_value: with_values, with_errors: with_errors).reject {|k,_| k==:name}]}]
      end
    end
57763
function toJSON() {
    var s = this;
    var values = Object.assign({}, s.schema);
    Object.keys(values).forEach(function (key) {
      var isFunc = iftype.isFunction(values[key]);

      if (isFunc) {
        delete values[key];
      }
    });
    return values;
  }
193461
function hashValue(it) {
	const str = JSON.stringify(it) || '';
	let hash = 5381;
	let i = str.length;
	while (i) {
		hash = hash * 33 ^ str.charCodeAt(--i);
	}
	return hash >>> 0;
}
667068
function RSAGetPublicString() {
  var exportObj = {n: this.n.toString(16), e: this.e.toString(16)};
  if (exportObj.n.length % 2 == 1) {
    exportObj.n = '0' + exportObj.n; // pad them with 0
  }
  return JSON.stringify(exportObj);
}
549998
def to_json(self):
    

    return {self.BLOB_KEY_PARAM: self._blob_key,
            self.START_FILE_INDEX_PARAM: self._start_file_index,
            self.END_FILE_INDEX_PARAM: self._end_file_index,
            self.OFFSET_PARAM: self._next_offset()}
496785
def to_hash
      keys = table_header_keys
      values = self
      hash = {}
      keys.each_with_index {|k,i| hash[k]=values[i]}
      return hash
    end
1231331
def to_hash
      stringified_params = Hash[parameters.map { |key, val| [key.to_s, val] }]
      base_hash.merge(stringified_params)
    end
567918
def ToJson(self):
        
        json = {}
        json["hash"] = self.Hash.To0xString()
        json["size"] = self.Size()
        json["version"] = self.Version
        json["previousblockhash"] = self.PrevHash.To0xString()
        json["merkleroot"] = self.MerkleRoot.To0xString()
        json["time"] = self.Timestamp
        json["index"] = self.Index
        nonce = bytearray(self.ConsensusData.to_bytes(8, 'little'))
        nonce.reverse()
        json["nonce"] = nonce.hex()
        json['nextconsensus'] = Crypto.ToAddress(self.NextConsensus)
        # json["consensus data"] = self.ConsensusData
        json["script"] = '' if not self.Script else self.Script.ToJson()
        return json
30002
function _rsapem_publicKeyToX509HexString(rsaKey) {
    var encodedIdentifier = "06092A864886F70D010101";
    var encodedNull = "0500";
    var headerSequence = "300D" + encodedIdentifier + encodedNull;

    var keys = _rsapem_derEncodeNumber(rsaKey.n);
    keys += _rsapem_derEncodeNumber(rsaKey.e);

    var keySequence = "0030" + _rsapem_encodeLength(keys.length / 2) + keys;
    var bitstring = "03" + _rsapem_encodeLength(keySequence.length / 2) + keySequence;

    var mainSequence = headerSequence + bitstring;

    return "30" + _rsapem_encodeLength(mainSequence.length / 2) + mainSequence;
}
328947
def as_json(options=nil)
      return {} if messages.empty?
      attribute, types = messages.first
      type             = types.first

      {
        :error => {
          :param => attribute,
          :type  => type,
          :message => nil
        }
      }
    end
1232671
def values(key)
      h = hash(key)

      hoff = @hashes[(h % 256)*2]
      hlen = @hashes[(h % 256)*2 + 1]

      return [] if hlen == 0
      off = (h / 256) % hlen

      vals = []

      # FIXME: Is this potentially an infinite loop (if full)?
      # Easy to avoid by exiting if off reaches the same value twice.

      while
          (slot = read(hoff + off * hashref_size .. hoff + off * hashref_size + hashref_size - 1)) &&
          (dslot = ary_unpack(slot,2)) && dslot[1] != 0

        if dslot[0] == h
          pos = dslot[1]

          rkey, value = read_entry(pos)
          if rkey == key
            vals << value
          end
        end
        off = (off + 1) % hlen
      end
      return vals
    end
864067
private String toJsonString() {
        Map<String, String> map = new HashMap<String, String>();
        byte[] encryptedCEK = getEncryptedCEK();
        map.put(Headers.CRYPTO_KEY_V2, Base64.encodeAsString(encryptedCEK));
        byte[] iv = cipherLite.getIV();
        map.put(Headers.CRYPTO_IV, Base64.encodeAsString(iv));
        map.put(Headers.MATERIALS_DESCRIPTION, kekMaterialDescAsJson());
        // The CRYPTO_CEK_ALGORITHM, CRYPTO_TAG_LENGTH and
        // CRYPTO_KEYWRAP_ALGORITHM were not available in the Encryption Only
        // (EO) implementation
        ContentCryptoScheme scheme = getContentCryptoScheme();
        map.put(Headers.CRYPTO_CEK_ALGORITHM, scheme.getCipherAlgorithm());
        int tagLen = scheme.getTagLengthInBits();
        if (tagLen > 0)
            map.put(Headers.CRYPTO_TAG_LENGTH, String.valueOf(tagLen));
        String keyWrapAlgo = getKeyWrappingAlgorithm();
        if (keyWrapAlgo != null)
            map.put(Headers.CRYPTO_KEYWRAP_ALGORITHM, keyWrapAlgo);
        return Jackson.toJsonString(map);
    }
64089
def to_json(self):
    

    params = dict(self.__params)  # Shallow copy.
    if self._PROTOTYPE_REQUEST_PARAM in params:
      prototype_request = params[self._PROTOTYPE_REQUEST_PARAM]
      params[self._PROTOTYPE_REQUEST_PARAM] = prototype_request.Encode()
    if self._OFFSET_PARAM in params:
      params[self._OFFSET_PARAM] = base64.b64encode(params[self._OFFSET_PARAM])
    return params
949667
def read_json_integer
      @context.read(@reader)
      if (@context.escapeNum)
        read_json_syntax_char(@@kJSONStringDelimiter)
      end
      str = read_json_numeric_chars

      begin
        num = Integer(str);
      rescue
        raise ProtocolException.new(ProtocolException::INVALID_DATA, "Expected numeric value; got \"#{str}\"")
      end

      if (@context.escapeNum)
        read_json_syntax_char(@@kJSONStringDelimiter)
      end

      return num
    end
784362
function serializeHash() {
      var hash = {}
      eachFormElement.apply(function (name, value) {
        if (name in hash) {
          hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])
          hash[name].push(value)
        } else hash[name] = value
      }, arguments)
      return hash
    }
897916
protected function getValuesJSON() {
		$value = $this->value;
		if($value instanceof SS_List) {
			$values = $value->column($this->idField);
		}
		else if(is_array($value)) {
			$values = array_keys($value);
		}
		else if(is_string($value)) {
			$values = explode(',', $value);
			$values = str_replace('{comma}', ',', $values);
		}

		return $this->formatJSON($this->source->filter(array(
			$this->idField => $values
		)));
	}