Skip to main content

value_to_json

Function value_to_json 

Source
pub fn value_to_json(value: &Value<'static>) -> Json
Expand description

Turns one engine value into the JSON a result carries.

A blob is {"blob": "<hex>"}, which is the grammar it goes in as (task-2066 §4.1.15). It used to be the string "x'00ff'", typed text in the column list while typeof said blob - so nothing distinguished it from a TEXT column that literally holds that text, and bytes went in through --params and could not come back. That affects Node, Go, PHP and the subprocess half of Python: four of the six bindings advertised.

The envelope matches literal_of’s input grammar exactly, so a value read out of one result can be bound into the next statement with no conversion - which is what “read back” has to mean for a wire format. class_of reports an object as blob, so the column type follows without a second rule.

@param value - the cell the engine produced