json

JSON (JavaScript Object Notation) parser and stringifier

0 downloads owners: imabd645 repository

Install

ez install json

Dependencies (1.0.0)

PackageRange
No dependencies.

Readme

JSON Library

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.

Installation

This library is included in the standard ezlib packages. Import it via:

use "json"

Functions

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)

Versions

VersionSizeDownloadsPublished
1.0.0 7.1 KB 0 1 hour ago

Integrity

sha256  98a9f311ee946ea52af5caf5a152ccc0232499bc9133d7200fbb663a33aa8831