JSON (JavaScript Object Notation) parser and stringifier
ez install json
| Package | Range |
|---|---|
| No dependencies. | |
A complete JSON (JavaScript Object Notation) parser and stringifier for EZ. Written entirely in pure EZ, it translates JSON text into EZ Arrays and Dictionaries, and vice versa.
This library is included in the standard ezlib packages. Import it via:
use "json"
parse(jsonString)Parses a JSON string and returns the equivalent EZ data structure (Dictionary, Array, string, number, boolean, or nil).
dataStr = "{\"name\": \"Alice\", \"skills\": [\"EZ\", \"C++\"]}"
obj = json.parse(dataStr)
out obj["skills"][0] # "EZ"
stringify(data)Converts an EZ data structure into a JSON string.
myDict = {
"title": "EZ Language",
"awesome": true,
"version": 6.0
}
jsonStr = json.stringify(myDict)
read(filePath)Reads a JSON file directly from disk and parses it.
config = json.read("config.json")
write(filePath, data)Stringifies and writes EZ data directly to a JSON file.
success = json.write("output.json", config)| Version | Size | Downloads | Published |
|---|---|---|---|
1.0.0 |
7.1 KB | 0 | 1 hour ago |
sha256 98a9f311ee946ea52af5caf5a152ccc0232499bc9133d7200fbb663a33aa8831