Mwnci savejson() Function

Syntax

savejson(filename, iterable)

Description

The savejson() function writes a given JSON structure as a string to the named file. The JSON is fully expanded in the file”

Example

include("json")
a=[{"name": "Neddie", "age": 12},{"name": "grytpipe", "age": 4}]
savejson("/tmp/foo.json", a)

/tmp/foo.json will contain:

[
  {
    "name": "Neddie",
    "age": 12
  },
  {
    "name": "grytpipe",
    "age": 4
  }
]