content/flux/v0/stdlib/json/encode.md
json.encode() converts a value into JSON bytes.
This function encodes Flux types as follows:
(v: A) => bytes
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
({{< req >}}) Value to convert.
import "json"
jsonData = {foo: "bar", baz: 123, quz: [4, 5, 6]}
json.encode(
v: jsonData,
)// Returns [123 34 98 97 122 34 58 49 50 51 44 34 102 111 111 34 58 34 98 97 114 34 44 34 113 117 122 34 58 91 52 44 53 44 54 93 125]