Skip to main content

json

Package json provides JSON encoding and decoding for durable programs. Copyright 2020 The Bazel Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

load("json", ...)

json​

Package json provides JSON encoding and decoding for durable programs.
Copyright 2020 The Bazel Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
load("json", ...)

Functions​

encode(input: Value)​

Example:

load("json", "json")
json.encode({})
json.encode("")

Parameters:

NameTypeRequiredDescription
inputValue✓

Returns: String


encode_indent(input: Value, prefix: String?, indent: String?)​

Example:

load("json", "json")
json.encode_indent({})
json.encode_indent("")

Parameters:

NameTypeRequiredDescription
inputValue✓
prefixString
indentString

Returns: String


decode(input: String, default: Value?)​

Example:

load("json", "json")
json.decode("{}")
json.decode("FOO")

Parameters:

NameTypeRequiredDescription
inputString✓
defaultValue

Returns: Value