Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Official ZPE/YASS documentationjbml_decode

jbml_decode (string data) ⇒ map

Parses a string in the JBML format to a map. The resulting map may contain additional maps inside it representing groups of values. For more information see https://github.com/jamiebalfour04/JBML-Formal-Specification/.

First available: Version 1.13.2

Notes

The JBML format is available to read on my GitHub.

JBML is similar to TOML and INI, making its implementation quick and easy. It does however feature additional data types such as the map ({ x : y }) and like TOML it also features the array/list data type. JBML also supports inline concatenation that allows you to concatenate two string values.

# Basic settings
[General]
app_name = "MyApp"
version = "1.0.0"
supported_languages = {"en" : "English", "es" : "Spanish", "fr" : "French"}

[UserSettings]
theme = "dark"
font_size = 12

[Network]
ips = ["192.168.1.1", "192.168.1.2", "192.168.1.254"]
connection_max = 5000
enabled = true
port = 8080
hosts = [
  "alpha",
  "omega"
]

# Database settings
[Database]
host = "localhost"
port = 5432
[Database.credentials]
username = "admin"
password = "secret"

With the above, we can run some code like below to get data out:

YASS
$contents = file_get_contents("network.jbml")
$jbml = jbml_decode($contents)
print($jbml["General"]["supported_languages"]["en"])
Comments
Feedback 👍
Comments are sent via email to me.