2019-07-11 18:37:38 +02:00
|
|
|
---
|
|
|
|
title: 'encoding/json'
|
|
|
|
---
|
2019-07-10 01:54:15 +02:00
|
|
|
|
2019-07-11 18:37:38 +02:00
|
|
|
json provides functions for working with json data
|
2020-03-23 21:18:06 +01:00
|
|
|
|
|
|
|
## Index
|
|
|
|
|
|
|
|
|
|
|
|
* [def <b>dumps</b>(obj) string](#def-ijsonibdumpsb)
|
|
|
|
* [def <b>loads</b>(source) object](#def-ijsonibloadsb)
|
|
|
|
|
|
|
|
|
2019-07-10 01:54:15 +02:00
|
|
|
## Functions
|
|
|
|
|
2019-07-11 18:45:42 +02:00
|
|
|
|
2020-03-23 21:18:06 +01:00
|
|
|
#### def <i>json</i>.<b>dumps</b>
|
2019-07-11 18:37:38 +02:00
|
|
|
```go
|
2020-03-23 21:18:06 +01:00
|
|
|
json.dumps(obj) string
|
2019-07-11 18:37:38 +02:00
|
|
|
```
|
2019-07-10 01:54:15 +02:00
|
|
|
serialize obj to a JSON string
|
|
|
|
|
2020-03-23 21:18:06 +01:00
|
|
|
###### Arguments
|
2019-07-10 01:54:15 +02:00
|
|
|
|
|
|
|
| name | type | description |
|
|
|
|
|------|------|-------------|
|
2020-03-23 21:18:06 +01:00
|
|
|
| `obj` | `object` | input object |
|
2019-07-10 01:54:15 +02:00
|
|
|
|
|
|
|
|
2019-07-11 18:45:42 +02:00
|
|
|
|
2020-03-23 21:18:06 +01:00
|
|
|
#### def <i>json</i>.<b>loads</b>
|
2019-07-11 18:37:38 +02:00
|
|
|
```go
|
2020-03-23 21:18:06 +01:00
|
|
|
json.loads(source) object
|
2019-07-11 18:37:38 +02:00
|
|
|
```
|
2019-07-10 01:54:15 +02:00
|
|
|
read a source JSON string to a starlark object
|
|
|
|
|
2020-03-23 21:18:06 +01:00
|
|
|
###### Arguments
|
2019-07-10 01:54:15 +02:00
|
|
|
|
|
|
|
| name | type | description |
|
|
|
|
|------|------|-------------|
|
2020-03-23 21:18:06 +01:00
|
|
|
| `source` | `string` | input string of json data |
|
2019-07-11 18:37:38 +02:00
|
|
|
|
2019-07-10 01:54:15 +02:00
|
|
|
|
|
|
|
|