- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparser.txs
More file actions
Latest commit
16 lines (12 loc) · 406 Bytes
/
Copy pathparser.txs
File metadata and controls
16 lines (12 loc) · 406 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# JSON Encoding and Decoding Example
use json
raw_json = "{\"name\": \"TechScript\", \"version\": 2, \"active\": true}"
# Decode JSON string to map
data = json.decode(raw_json)
say $"Decoded Name: {data.name}"
say $"Decoded Version: {data.version}"
say $"Decoded Active: {data.active}"
# Modify and re-encode to JSON
data["status"] = "stable"
encoded = json.encode(data)
say $"Encoded JSON: {encoded}"